Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- /**
- * Created by igelov on 13/03/2017.
- */
- public class CurrencyConverter {
- public static void main(String[] args) {
- Scanner console = new Scanner(System.in);
- double value = Double.parseDouble(console.nextLine());
- String inCurrency = console.nextLine();
- String outCurrency = console.nextLine();
- double m = 0;
- switch (inCurrency){
- case "USD":
- m = value*1.79549;
- break;
- case "EUR":
- m = value*1.95583;
- break;
- case "GBP":
- m = value*2.53405;
- break;
- case "BGN":
- m = value;
- break;
- default:
- System.out.println("No Such Currency Available ");
- }
- switch (outCurrency){
- case "USD":
- System.out.printf("%.2f USD", m/1.79549);
- break;
- case "EUR":
- System.out.printf("%.2f EUR", m/1.95583);
- break;
- case "GBP":
- System.out.printf("%.2f GBP", m/2.53405);
- break;
- case "BGN":
- System.out.printf("%.2f BGN", m);
- break;
- default:
- System.out.println("No Such Currency Available ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement