Currency Conversion Program

 

Overview:  Write a program that allows the user to convert currency between US Dollars and Foreign Currency.

 

Specifics:

 

The user should be asked whether they wish to convert:

This choice should be menu-driven; their choice should be a one-character answer.  (Hint:  If you stick with numbers instead of letters, the user can’t use the wrong case.)

 

After they’ve chosen which direction they are converting, they should choose the foreign currency.  This will also be menu driven.  They should have the following choices:

If the user chooses “Other”, the program should prompt them for the exchange rate (What is the USD – Foreign Rate?)  Otherwise, your program should know the exchange rate.

 

Use the following website to get current exchange rates.

 

http://www.x-rates.com/d/USD/table.html

 

After they’ve made their two choices, they should enter the amount to exchange (either USD or Foreign). 

 

The program computes the exchange value and displays on the screen.

 

Notes: 

 

  1. This is an ideal program for the SWITCH structure as opposed to the IF structure.

 

  1. SWITCH statements have a default option for when no cases are met.  Since we aren’t using data validation yet, this can be useful for when the user doesn’t enter one of the valid options. 

 

  1. Constants should be used in this program.  The exchange rate is something that will not change as the program runs, but it could change between times the program is used.