Design a currency Converter class whose object will handle conversion of three currencies (Dollar, Ringgit, Pound). A single object of the new currency Converter class you design here will handle all these three currencies. Instead of having specific conversion methods such as toDollar, toPound and so forth, the new currency Converter class supports one generic conversion method call exchange. The method has three arguments: fromCurrency, toCurrency and amount. The first two arguments are String and give the names of currencies. The third argument is the amount that need to be converted. For example, to convert RM250 to dollar, we write:
dollar = converter.exchange(‘ringgit”, “dollar”, 250.0);
To set the exchange rate for a currency, we use the setRate method. This method takes three arguments. The first two arguments are the currency names, and the third argument is the rate. For example, if the exchange rate for dollar is 3.4 Dollar to RM1, then we write:
converter.setRate(“dollar”, “ringgit”, 3.4);
In addition, the class also have the following method:
updateRate (“fromCurrency”, “toCurrency”, newRate) - The first two arguments are the currency names, and the third argument is the new exchange rate.
Finally, test your program by creating its object in the main() method.
So far this is my code..but how to prompt user to input the name of currency, name of currency to convert, amount and the rate..