Advertisement
Guest User

CC

a guest
Jul 23rd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.util.HashMap;
  2. import java.util.Scanner;
  3.  
  4. public class CurrencyConverter {
  5.     public static void main(String[] args) {
  6.         HashMap<String, Double> m = new HashMap<>();
  7.         Scanner in = new Scanner(System.in);
  8.         double entrance = in.nextDouble();
  9.         String value1 = in.next();
  10.         String value2 = in.next();
  11.         m.put("BGN", 1.0);
  12.         m.put("USD", 1.79549);
  13.         m.put("GBP", 2.53405);
  14.         m.put("EUR", 1.95583);
  15.         double result = m.get(value1) / m.get(value2) * entrance;
  16.         System.out.printf("%.2f %s", result, value2);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement