Nackey

CurrencyConverter

Jul 12th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.68 KB | None | 0 0
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class CurrencyConverter {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         double  entryNumber = Double.parseDouble(scanner.nextLine());
  10.         String currency = scanner.nextLine();
  11.         String secondCurrency = scanner.nextLine();
  12.  
  13.         if(currency.equals("USD") && secondCurrency.equals("BGN")) {
  14.  
  15.             double usdtobgn = (entryNumber * 1.79549) / 1;
  16.             System.out.printf("%.2f", usdtobgn);
  17.         }
  18.  
  19.         if(currency.equals("USD") && secondCurrency.equals("GBP")) {
  20.  
  21.             double usdtogbp = (entryNumber * 1.79549) / 2.53405;
  22.             System.out.printf("%.2f", usdtogbp);
  23.         }
  24.  
  25.         if(currency.equals("USD") && secondCurrency.equals("EUR")) {
  26.  
  27.             double UsdToEur = (entryNumber * 1.79549) / 1.95583;
  28.             System.out.printf("%.2f",UsdToEur);
  29.         }
  30.  
  31.         if(currency.equals("BGN") && secondCurrency.equals("USD")) {
  32.  
  33.             double bgntousd = (entryNumber * 1) / 1.79549;
  34.             System.out.printf("%.2f", bgntousd);
  35.         }
  36.  
  37.         if(currency.equals("BGN") && secondCurrency.equals("GBP")) {
  38.  
  39.             double bgntogbp = (entryNumber * 1) / 2.53405;
  40.             System.out.printf("%.2f", bgntogbp);
  41.         }
  42.  
  43.         if(currency.equals("BGN") && secondCurrency.equals("EUR")) {
  44.  
  45.             double bgntoeur = (entryNumber * 1) / 1.95583;
  46.             System.out.printf("%.2f", bgntoeur);
  47.         }
  48.  
  49.         if(currency.equals("GBP") && secondCurrency.equals("BGN")) {
  50.  
  51.             double gbptobgn = (entryNumber * 2.53405) / 1;
  52.             System.out.printf("%.2f", gbptobgn);
  53.         }
  54.  
  55.         if(currency.equals("GBP") && secondCurrency.equals("USD")) {
  56.  
  57.             double gbptousd = (entryNumber * 2.53405) / 1.79549;
  58.             System.out.printf("%.2f", gbptousd);
  59.         }
  60.  
  61.         if(currency.equals("GBP") && secondCurrency.equals("EUR")) {
  62.  
  63.             double gbptoeur = (entryNumber * 2.53405) / 1.95583;
  64.             System.out.printf("%.2f", gbptoeur);
  65.         }
  66.  
  67.         if(currency.equals("EUR") && secondCurrency.equals("BGN")) {
  68.  
  69.             double eurtobgn = (entryNumber * 1.95583) / 1;
  70.             System.out.printf("%.2f", eurtobgn);
  71.         }
  72.  
  73.         if(currency.equals("EUR") && secondCurrency.equals("USD")) {
  74.  
  75.             double eurtousd = (entryNumber * 1.95583) / 1.79549;
  76.             System.out.printf("%.2f", eurtousd);
  77.         }
  78.  
  79.         if(currency.equals("EUR") && secondCurrency.equals("GBP")) {
  80.  
  81.             double eurtogbp = (entryNumber * 1.95583) / 2.53405;
  82.             System.out.printf("%.2f", eurtogbp);
  83.         }
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment