Задача CurrencyConverter
Къде ми е проблема?
package SimpleCalculations;
import java.util.Scanner;
public class CurrencyConverter {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double price1 = Double.valueOf(scan.nextLine());
double arg = 1.79549;
double arg2 = 1.95583;
double arg3 = 2.53405;
String name1 = scan.nextLine();
String name2 = scan.nextLine();
name1.equals("USD");
name1.equals("EUR");
name1.equals("BGN");
name1.equals("GBP");
name2.equals("EUR");
if (name1.equals("USD")) {
//USD to BGN 20 = 35.91
System.out.printf("%.2f", price1 * arg);
} else if (name1.equals("BGN")) {
//BGN to EUR 100 = 51.13
System.out.printf("%.2f", price1 / arg2);
} else if (name1.equals("EUR")) {
//EUR to GBP 12.35 = 9.53
System.out.printf("%.2f", (price1 * arg2) / arg3);
} else if (name1.equals("USD") && name2.equals("EUR")) {
//USD to EUR 150.35 = 138.02
System.out.printf("%.2f", (price1 * arg) / arg2);
} else if (name1.equals("GBP")) {
//GBP to USD 12.35 = 17.43
System.out.printf("%.2f", (price1 * arg3) / arg);
}
}
}