Currency Conversion Program

Only available on StudyMode
  • Download(s) : 294
  • Published : August 26, 2012
Open Document
Text Preview
Application – Level Requirements

1. Get input from user.
2. User selects the type of currency they wish to convert. 3. User enters the amount of currency they wish to convert. 4. Currency is converted using established conversion rates. 5. Completed conversion amount is displayed for the user.

IPO Chart

Input| Process| Output|
(Keyboard) User enters selection| Get type of foreign currency| ForeignCurrencyType (string)| (Keyboard) User enters amount| Get amount of foreign currency| ForeignCurrency (float)| Rate (float)ForeignCurrency (float)| Convert Currency| USDollar (float)| ForeignCurrencyType (string)ForeignCurrency(float)USDollar (float)| Display converted currency| (output results to screen)|

Main Module

Display Module
User Input Module
Menu Module

Calculation Module

Control Flow Diagram—Main Control

-------------------------------------------------
Begin
Menu Module

Quit
?
Thank you for using the currency conversion program.”

User Input Module

Yes
No
Calculation
Module

Display Module

End

-------------------------------------------------

Control Flow Diagram—Menu Module

Begin
Welcome message

Valid
selection
?
Error
4
:
Invalid
menu selection
No
Yes
End
Quit
?
Yes
Write “Are you sure?”

Quit
Verified
?

Yes
Select foreign currency type

Is selected currency correct?

No
Conversion
Verified
?
No
Yes

No
|

Control Flow Diagram—User Input Module

Please enter the amount of foreign currency you would like to convert.

Write “Please enter a non-negative number.”

Input ForeignCurrency

Write “Invalid entry. Please try again.”

|

Control Flow Diagram—Calculation Module

French?
Japanese?
Mexican?
Begin
Canadian
?
Rate = 1.4680

English
?

No
No
No
No
No

Yes
Yes
Yes
Yes
Yes
Rate = 9.5085

Rate = 0.6085

Rate = 104.9200

Rate
=
6.2561
Rate
=
0
.
0
US Value
=
Rate*ForeignCurrency

End

|

Control Flow Diagram—DisplayModule

Additional countries
are unavailable

Nation = French
Currency = Francs
Nation = Japanese
Currency = Yen
Nation = English
Currency = Pounds

Nation = Mexian
Currency = Pesos

Japanese?

English?

Mexian?

Canadian?
|

Input

ForeignCurrency (float)
ForeginCurrencyType (string)
Rate (float)

Output

USDollar (float)
ForeginCurrency (float)
ForeginCurrencyType (string)
ExitMessage (string)

Main Module
Start Main Module
Declare ForeignCurrency as float
Declare ForeginCurrencyType as string
Declare Rate as float
Declare USDollar as float
Declare QuitProg as string
Declare Verify as string
If QuitProg = Y or y
Then write “Thank you for using the currency conversion program”
and End Main Module
End If
Call Menu Module
Call User Input Module
Call Calculation Module
Call Display Module
End Main Module

Menu Module
Start Menu Module
Declare Continue as string
Write “Welcome to the Currency Conversion program!”
Write “Please select the type of currency you wish to convert from the following: 1. Canadian Dollars
2. Mexican Pesos
3. English Pounds
4. Japanese Yen
5. French Francs
6. Quit”
Input ForeignCurrencyType
If ForeignCurrencyType = 1
Then ForeignCurrencyType = Candian
Else
If ForeginCurrencyType = 2
Then ForeignCurrencyType = Mexican
Else
If ForeginCurrencyType = 3
Then ForeignCurrencyType = English
Else
If ForeginCurrencyType = 4
Then ForeginCurrencyType = Japanese
Else
If ForeginCurrencyType = 5
Then ForeginCurrencyType = French
Else
If ForeginCurrencyType = 6
Then Write “Are you sure you want to quit? Y/N”
Input QuitProg
End If
If QuitProg = Y or y
Write “Are you sure?”
Input QuitProg
End If
If Quit Prog = Y or y
Then write “Thank you for using the currency conversion program.”...
tracking img