public class CurrencyConverter { public double rate(String typeOfCurrency){ double rate = 0; if(typeOfCurrency.equals("USD")){ rate = 1; //US dollar } if(typeOfCurrency.equals("EUR")){ rate = 0.94; //euro } if(typeOfCurrency.equals("GBP")){ rate = 0.82; //british pound } if(typeOfCurrency.equals("INR")){ rate = 68.32; //indian rupee } if(typeOfCurrency.equals("AUD")){ rate = 1.35; //australian dollar } if(typeOfCurrency.equals("CAD")){ rate = 1.32; //canadian dollar } if(typeOfCurrency.equals("SGD")){ rate = 1.43; //singapore dollar } if(typeOfCurrency.equals("CHF")){ rate = 1.01; //swiss franc } if(typeOfCurrency.equals("MYR")){ rate = 4.47; //malaysian ringgit } if(typeOfCurrency.equals("JPY")){ rate = 115.84; //japanese yen } if(typeOfCurrency.equals("CNY")){ rate = 6.92; //chinese yuan renminbi } return rate; } public double convertCurrency(String whereTo, String whereFrom, double amount){ return rate(whereTo)*amount/rate(whereFrom); } }