Answer to Question #23030 in Java | JSP | JSF for Rajuu
dollar = converter.exchange(‘peso”, “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 2.1 Dollar to Peso1, then we write:
converter.setRate(“dollar”, “peso”, 2.1);
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.
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!