Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class CurrencyConverter {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double entryNumber = Double.parseDouble(scanner.nextLine());
- String currency = scanner.nextLine();
- String secondCurrency = scanner.nextLine();
- if(currency.equals("USD") && secondCurrency.equals("BGN")) {
- double usdtobgn = (entryNumber * 1.79549) / 1;
- System.out.printf("%.2f", usdtobgn);
- }
- if(currency.equals("USD") && secondCurrency.equals("GBP")) {
- double usdtogbp = (entryNumber * 1.79549) / 2.53405;
- System.out.printf("%.2f", usdtogbp);
- }
- if(currency.equals("USD") && secondCurrency.equals("EUR")) {
- double UsdToEur = (entryNumber * 1.79549) / 1.95583;
- System.out.printf("%.2f",UsdToEur);
- }
- if(currency.equals("BGN") && secondCurrency.equals("USD")) {
- double bgntousd = (entryNumber * 1) / 1.79549;
- System.out.printf("%.2f", bgntousd);
- }
- if(currency.equals("BGN") && secondCurrency.equals("GBP")) {
- double bgntogbp = (entryNumber * 1) / 2.53405;
- System.out.printf("%.2f", bgntogbp);
- }
- if(currency.equals("BGN") && secondCurrency.equals("EUR")) {
- double bgntoeur = (entryNumber * 1) / 1.95583;
- System.out.printf("%.2f", bgntoeur);
- }
- if(currency.equals("GBP") && secondCurrency.equals("BGN")) {
- double gbptobgn = (entryNumber * 2.53405) / 1;
- System.out.printf("%.2f", gbptobgn);
- }
- if(currency.equals("GBP") && secondCurrency.equals("USD")) {
- double gbptousd = (entryNumber * 2.53405) / 1.79549;
- System.out.printf("%.2f", gbptousd);
- }
- if(currency.equals("GBP") && secondCurrency.equals("EUR")) {
- double gbptoeur = (entryNumber * 2.53405) / 1.95583;
- System.out.printf("%.2f", gbptoeur);
- }
- if(currency.equals("EUR") && secondCurrency.equals("BGN")) {
- double eurtobgn = (entryNumber * 1.95583) / 1;
- System.out.printf("%.2f", eurtobgn);
- }
- if(currency.equals("EUR") && secondCurrency.equals("USD")) {
- double eurtousd = (entryNumber * 1.95583) / 1.79549;
- System.out.printf("%.2f", eurtousd);
- }
- if(currency.equals("EUR") && secondCurrency.equals("GBP")) {
- double eurtogbp = (entryNumber * 1.95583) / 2.53405;
- System.out.printf("%.2f", eurtogbp);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment