Currency converter, Summer 2017

A set of predefined currencies shall be mutually converted. The user will be able to choose both a buy and a sell currency. The desired buy amount shall than be converted into the corresponding sell currency amount. The following video illustrates its intended usage:

Figure 601. Running the currency converter terminal application. Slide presentation

You may follow the subsequent steps:

  1. Choose a suitable representation which allows for defining currencies among with their corresponding conversion rates. A good starting point is being provided by IMF SDR currency units leading to flat currency table structures. These allow for a simple text file representation e.g. currencies.txt:

    Chinese Yuan:	9.348070
    Euro:	1.264280
    Japanese Yen:	153.778000
    U.K. Pound Sterling:	1.102940
    U.S. Dollar:	1.356070
    Algerian Dinar:	148.618000
    ...

    The rates being provided here allow for converting each currency to its SDR value. Thus converting e.g. Euro to U.S. Dollar requires a conversion to its SDR value followed by a second conversion to U.S. Dollar.

    This way we only have to store a single rate for each currency in question.

  2. Write a class reading the above table and storing all currencies among with their rates into a suitable array. How to Open a File in Java provides different methods reading and scanning file input.

  3. Create user interface dialogs providing the »glue« to access currency information.