Project: Currency Class
Write a class for converting between different currencies. The class should be immutable. Create a single constructor that takes a double value and a string representing the currency. Write a getter that take a currency type string and returns the value in that currency as a double. Include currencies for USD, EUR, JPY, GBP, CAD, CNY, RUB, MXN, AUD, INR and Bitcoin (XBT). Have a method for setting the current conversion rates by passing a map. Also have a toString() like method that takes a currency code and then returns the value formatted with its currency symbol.
See [[wikipidea or link]] See other project
Output
$ javac -Xlint CurrencyClass.java
$ java -ea CurrencyClass
Today's currency rates set.
USD to AUD: $1.00 = $ 1.26
USD to CAD: $1.00 = $ 1.26
USD to CNY: $1.00 = ¥ 6.47
USD to EUR: $1.00 = 0,82 €
USD to GBP: $1.00 = £ 0.71
USD to INR: $1.00 = ₹ 72.49
USD to JPY: $1.00 = ¥ 105.07
USD to MXN: $1.00 = $ 20.68
USD to RUB: $1.00 = 74,29 ₽
USD to USD: $1.00 = $1.00
USD to XBT: $1.00 = 0.00 BTC
USD to AUD: $1,505.56 = $ 1,897.01
USD to CAD: $1,505.56 = $ 1,897.01
USD to CNY: $1,505.56 = ¥ 9,740.98
USD to EUR: $1,505.56 = 1.234,56 €
USD to GBP: $1,505.56 = £ 1,068.95
USD to INR: $1,505.56 = ₹ 109,138.12
USD to JPY: $1,505.56 = ¥ 158,189.29
USD to MXN: $1,505.56 = $ 31,135.00
USD to RUB: $1,505.56 = 111.848,12 ₽
USD to USD: $1,505.56 = $1,505.56
USD to XBT: $1,505.56 = 0.03 BTC