Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class currencyConverterTwo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- Double amount = Double.parseDouble(scanner.nextLine());
- String inputCurrency = scanner.nextLine();
- String outputCurrency = scanner.nextLine();
- if (inputCurrency.equals("BGN")){
- amount = amount * 1;
- } else if (inputCurrency.equals("USD")) {
- amount = amount * 1.79549;
- } else if (inputCurrency.equals("EUR")) {
- amount = amount * 1.95583;
- } else if (inputCurrency.equals("GBP")) {
- amount = amount * 2.53405;
- }
- if (outputCurrency.equals("BGN")){
- amount = amount / 1;
- } else if (outputCurrency.equals("USD")) {
- amount = amount / 1.79549;
- } else if (outputCurrency.equals("EUR")) {
- amount = amount / 1.95583;
- } else if (outputCurrency.equals("GBP")) {
- amount = amount / 2.53405;
- }
- System.out.printf("%.2f, %s", amount, outputCurrency);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement