Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.BigDecimal;
- import java.util.ArrayList;
- import java.util.Scanner;
- public class main {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- System.out.print("From > ");
- String[] from = scan.nextLine().split(": ");
- System.out.print("To > ");
- String to = scan.nextLine();
- double val = Integer.parseInt(from[1]);
- if (from[0].equalsIgnoreCase("bgn")
- && to.equalsIgnoreCase("usd")) {
- val *= 0.5677;
- System.out.printf("%.2f USD", val);
- } else if (from[0].equalsIgnoreCase("usd")
- && to.equalsIgnoreCase("bgn")) {
- val *= 1.7608;
- System.out.printf("%.2f BGN", val);
- } else if (from[0].equalsIgnoreCase("euro")
- && to.equalsIgnoreCase("bgn")) {
- val *= 1.9558;
- System.out.printf("%.2f BGN", val);
- } else if (from[0].equalsIgnoreCase("bgn")
- && to.equalsIgnoreCase("euro")) {
- val *= 0.5113;
- System.out.printf("%.2f EUR", val);
- }else if (from[0].equalsIgnoreCase("euro")
- && to.equalsIgnoreCase("usd")) {
- val *= 1.1109;
- System.out.printf("%.2f USD", val);
- }else if (from[0].equalsIgnoreCase("usd")
- && to.equalsIgnoreCase("euro")) {
- val *= 0.8998;
- System.out.printf("%.2f EUR", val);
- }else if (from[0].equalsIgnoreCase("pound")
- && to.equalsIgnoreCase("bgn")) {
- val *= 2.2455;
- System.out.printf("%.2f BGN", val);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement