Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashMap;
- import java.util.Scanner;
- public class CurrencyConverter {
- public static void main(String[] args) {
- HashMap<String, Double> m = new HashMap<>();
- Scanner in = new Scanner(System.in);
- double entrance = in.nextDouble();
- String value1 = in.next();
- String value2 = in.next();
- m.put("BGN", 1.0);
- m.put("USD", 1.79549);
- m.put("GBP", 2.53405);
- m.put("EUR", 1.95583);
- double result = m.get(value1) / m.get(value2) * entrance;
- System.out.printf("%.2f %s", result, value2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement