Generate a set of test inputs and expected results for the Currency Conversion program.

profileartcot
currency_conversion_design.doc

PAGE

4

Main Module

Declare Source as string

Declare Currency_Type as integer

Declare Currency_Amount as float

Declare US_Dollar as float

Declare Quit as string

Call Input Module

Call Conversion Module

Call Exit Module

Call Output Module

END Main Module

Input Module

Display “Welcome to the Currency Conversion Program”

Display “Please select the type of currency (Enter 1-6)”

Display “Press 1 for Canadian Dollars”

Display “Press 2 for Mexican Pesos”

Display “Press 3 for English Pounds”

Display “Press 4 for Japanese Yen”

Display “Press 5 for French Euros”

Display “Press 6 to Quit”

Input Currency_Type

If

Currency_Type < 1

Display “Invalid Entry, please try again.”

If

Currency_Type > 6

Display “Invalid Entry, please try again.”

Call Input Module

End If

End If

Else

Call Conversion Module

End Input Module

Conversion Module

If

Currency_Type = 1

Source = “Canadian Dollars”

Display “Please enter the amount of currency(0-100,000:”

Input Currency_Amount

If

Currency_Amount < 0

Display “Invalid amount, please try again.”

Call Conversion Module

Else

If

Currency_Amount > 100,000

Display “Invalid amount, please try again.”

Call Conversion Module

Else

US_Dollar = Currency_Amount * 1.197703

End If

End If

Else

If

Currency_Type = 2

Source = “Mexican Pesos”

Display “Please enter the amount of currency (0-100,000:“

Input Currency_Amount

If

Currency_Amount < 0

Display “Invalid amount, please try again.”

Call Conversion Module

Else

If

Currency_Amount > 100,000

Display “Invalid amount, please try again.”

Call Conversion Module

Else

US_Dollar = Currency_Amount * 0.0687058

End If

End If

Call Output Module

Else

If

Currency_Type = 3

Source = “English Pounds”

Display“Please enter the amount of currency (0-100,000: “

Input Currency_Amount

If

Currency_Amount < 0

Display “Invalid amount, please try again.”

Call Conversion Module

Else

If

Currency_Amount > 100,000

Display “Invalid amount, please try again.”

Call Conversion Module

Else

US_Dollar = Currency_Amount * 0.659544

End If

End If

Call Output Module

ELSE

IF

Currency_Type = 4

Source = “Japanese Yen”

Display “Please enter the amount of currency (0-100,000: “

Input Currency_Amount

If

Currency_Amount < 0

Display “Invalid amount, please try again.”

Call Conversion Module

Else

If

Currency_Amount > 100,000

Display “Invalid amount, please try again.”

Call Conversion Module

Else

US_Dollar = Currency_Amount * 0.00850629

End If

End If

Call Output Module

Else

If

Currency_Type = 5

Source = “French Euros”

Display “Please enter the amount of currency (0-100,000: “

Input Currency_Amount

If

Currency_Amount < 0

Display “Invalid amount, please try again.”

Call Conversion Module

Else

If

Currency_Amount > 100,000

Display “Invalid amount, please try again.”

Call Conversion Module

Else

US_Dollar = Currency_Amount * 1.15616

End If

End If

Call Output Module

Else

If

Currency_Type = 6

Display “Are you sure you want to Quit? Y/N”

Input Quit

If

Quit = Y

Call Input Module

Else

If

Quit = y

Call Input Module

Else

If

Quit = N

End

Else

If

Quit = n

End

Else

Display “Invalid entry, please try again.”

Call Conversion Module

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End Conversion Module

Output Module

Display “The US Dollar value of “; Currency_Amount; Source “is $“; US_Dollar; “.”

Display “Press any key to return to the main menu”

Pause

Call Input Module

End Output Module