Advertisement
igelov

Untitled

Mar 17th, 2017
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4. * Created by igelov on 13/03/2017.
  5. */
  6. public class CurrencyConverter {
  7. public static void main(String[] args) {
  8. Scanner console = new Scanner(System.in);
  9. double value = Double.parseDouble(console.nextLine());
  10. String inCurrency = console.nextLine();
  11. String outCurrency = console.nextLine();
  12. double m = 0;
  13. switch (inCurrency){
  14. case "USD":
  15. m = value*1.79549;
  16. break;
  17. case "EUR":
  18. m = value*1.95583;
  19. break;
  20. case "GBP":
  21. m = value*2.53405;
  22. break;
  23. case "BGN":
  24. m = value;
  25. break;
  26. default:
  27. System.out.println("No Such Currency Available ");
  28. }
  29. switch (outCurrency){
  30. case "USD":
  31. System.out.printf("%.2f USD", m/1.79549);
  32. break;
  33. case "EUR":
  34. System.out.printf("%.2f EUR", m/1.95583);
  35. break;
  36. case "GBP":
  37. System.out.printf("%.2f GBP", m/2.53405);
  38. break;
  39. case "BGN":
  40. System.out.printf("%.2f BGN", m);
  41. break;
  42. default:
  43. System.out.println("No Such Currency Available ");
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement