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 592. Running the currency converter terminal application. Slide presentation Create comment in forum

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 which reads the above table and stores all currencies among with their rates in a suitable array.

  3. Provide user interface dialogs providing the «glue» between user input and stored currency information.