Currency Conversion

Only available on StudyMode
  • Download(s) : 195
  • Published : December 19, 2012
Open Document
Text Preview
Application-Level Requirements List
1. The program screen should display the title of the program with a welcome. 2. A description of how the program will be used.
3. User has 5 currencies (Canadian dollars, Mexican Pesos, English Pounds, Yen, and Francs) to choose from to convert to dollar amount or vice versa. 4. Program displays the dollar amount the chosen currency is equivalent to. 5. User has an option to quit the program or restart any with any other currency to convert. Input-Process-Output Chart

Complete the following Input-Process-Output chart for the application using a structured programming approach. InputProcessOutput
Menu OptionsInput all optional currenciesAll currencies displayed Number variables
Only number amount allowed in boxCurrency amount
Currency formula for conversion
(foreign currency to U.S. dollar)Currency conversionU.S. dollar equivalent amount Currency formula for conversion
(U.S. dollar to foreign currencyCurrency conversionForeign currency equivalent amount Restart or quit program
Optional choice requestsRestart or quit buttons

Hierarchy Chart

Control Flow Diagram—Main Control

Control Flow Diagram—Display Menu

Control Flow Diagram—Get_Int_Value

Control Flow Diagram—Convert Currency

Control Flow Diagram—Display_Results

Main Module
Call Control Module
Call Display Module
Call Get Int Value Module
Call Convert Module
Call Results Module
End Main Module

Control Module
Declare Currency as String
Write, “Currency Conversion Software”
Write, “Welcome to our software!”
Write, “Please select your currency to convert from any American dollar amount.” Write, “Enter 0 when complete.”
Write, “Enter Quit to leave software.”
Prompt for DollarCurrency
Input DollarCurrency
If Selection = 1 Then
Set Currency = Canadian
End If
If Selection = 2 Then
Set Currency = Mexican
End If
If Selection = 3 Then
Set Currency = Pounds
End If
If Selection = 4 Then
Set Currency = Yen
End If
If Selection = 5 Then
Set Currency = Francs
End If
If Selection = 0 Then
Write, “Thanks for choosing your foreign currency to convert.” End If
If Selection = Quit Then
Write, “Thank you for using our software!”
End If
End Main Control Module

Display Module
Declare Language as String
Write, “Please enter your preferred language.”
Write, “Enter 0 to reselect your language.”
Prompt for PreferredLanguage
Input PreferredLanguage
If Selection = 1 Then
Set Language = Spanish
End If
If Selection = 2 Then
Set Language = French
End If
If Selection = 3 Then
Set Language = Japanese
End If
If Selection = 0 Then
Write, “Please reselect your language.”
End If
End Display Module

Get Int Value Module
Write, “Enter currency value.”
Prompt for ForeignCurrency
Input ForeignCurrency
If ForeignCurrency 0 Then
Continue = false
Write, “Select new calculation.”
Continue = trye
End if
End while
End Get Int Value Module

Convert Module
Declare Currency[100]
Select Option of currency type
Option 1:
Set currency = 1/11.85
Option 2:
Set currency = 1/0.61
Option 3:
Set currency = 1/6.50
Option 4:
Set currency = 1/82
Option 5:
Set currency = 1/0.96
Option 6:
Set rate = 0.0
End Option
US Value = Rate * Int Value
End Convert Module

Display Results Module
Declare Country as String
Declare Currency as String
Select Option of currency type
Option Mexican:
Set Country =”Mexico”
Set Currency = “Pesos”
Option British:
Set Country = “Britain”
Set Currency = “English Pounds”
Option Japanese:
Set Country = “Japan”
Set Currency = “Yen”
Option French:
Set Country = “France”
Set Currency = “Francs”
Option Canadian:
Set Country = “Canada”
Set Currency = “Canadian Dollar”
End Option
End If
End While
End Display Results Module

Convert U.S. Dollars to foreign currencies:
Mexican Pesos$1Mexican...
tracking img