Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1.  
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6. * Created by Ivaylo on 24.4.2017 г..
  7. */
  8.  
  9. public class Multi {
  10. public static void main(String[] args) {
  11. Scanner scan = new Scanner(System.in);
  12. double moneyTostring = Double.parseDouble(scan.nextLine());
  13. String firstCurrency = scan.nextLine();
  14. String secondCurrency = scan.nextLine();
  15. double BGN = 1;
  16. double USD = 1.79549;
  17. double EUR = 1.95583;
  18. double GBP = 2.53405;
  19.  
  20. if (firstCurrency.equals("BGN")) {
  21. if (secondCurrency.equals("USD")) {
  22. System.out.printf("%.2f", BGN / USD * moneyTostring);
  23. } else if (secondCurrency.equals("EUR")) {
  24. System.out.printf("%.2f", BGN / EUR * moneyTostring);
  25. } else if (secondCurrency.equals("GBP")) {
  26. System.out.printf("%.2f", BGN / GBP * moneyTostring);
  27. }
  28. }
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement