Currency Conversion hierarchy chart

Main Program

Declare Value as real

Call Display Menu Module

Call Get_Int_Value Module

Call Convert_Currency Module

Call Display Results Module

End Main Program

Display Menu

Declare Language Module

Declare Convert_Currency as real

Print “Please select Language”

Get Int_Value

Print “Welcome to the Currency Converter, Enter Value:“

Input_Value

Convert Currency

US Value = (1 / 6.2561) * Int_Value =US Dollars

Convert Currency

Display Results

Print, Nation Int_Value,Currency, US Value
“Thank you for using Converter”

Pseudo code

Main Module

Declare selection as integer

Declare currencyType as Integer

Declare internationalValue as real

Declare USValue as real

Do While user wants to continue

Display Menu

Get International Value

Convert Currency

Display Results

End loop

Print exit message

End Main Module

Display Menu

Declare continue as Boolean

Set continue = true

While continue = true

Display "Currency conversion program"

Display "Please make a selection"

Display "1: Canadian Dollars"

Display "2: Mexican Pesos"

Display "3: English Pounds"

Display "4: Japanese Yen"

Display "5: French Francs"

Display "6: Quit"

Display "Enter a selection:";

Input currencyType

If currencyType >= 1 AND currencyType <= 5 then

Set continue = false

else if currencyType = 6

Display “Quitting Currency Conversion”

continue = false

else

Display “"Error 4: Invalid menu selection."

continue = true

end if

end While

End Display Menu

Get International Value

Declare value as integer

Declare continue as Boolean

Set continue = true

While continue = true

Display "Enter a currency value (positive number): "

Input internationalValue

if internationalValue > 0 AND internationValue <= 1000000 then

continue = false

else

Display “"Error 1: Invalid input--Negative Number"

continue = true

end if

end while

End Get International Value

Convert Currency

Declare rate as real

Select Case of currencyType

case 1:

Set rate = 1.4680

case 2:

Set rate = 9.5085

case 3:

Set rate = .6085

case 4:

Set rate = 104.92

case 5:

Set rate = 6.2561

default:

Set rate = 0.0

End Case

USValue = (1 / rate) * internationalValue

End Convert Currency

Display Results

Declare nation as string

Declare currency as string

Select Case of currencyType

case CANADIAN:

nation = "Canadian";

currency = "Dollars";

case MEXICAN:

nation = "Mexican";

currency = "Pesos";

case ENGLISH:

nation = "English";

currency = "Pounds";

case JAPANESE:

nation = "Japanese";

currency = "Yen";

case FRENCH:

nation = "French";

currency = "Francs";

default:

nation = "No country";

currency = "";

End Case

if currency > “” then

Display “The value of “, internationalValue, “ “ , nation, “ “, currency, “ is “,

usValue, “ dollars”

else

Display "Error 5: Invalid currency type."

end if

End Display Results

Control Flow Diagram—Display Menu

Control Flow Diagram—Get_Int_Value


Control Flow Diagram—Convert Currency

Control Flow Diagram—Display_Results

Test Values

Canadian (currency 1)

Input the Int Value as 100 Canadian Dollars

US Value = (1/ 1.468) * 400 = 272.40 US Dollars

Output: “The value of 100 English pounds is 164.33 US Dollars”

Mexican Pesos (currency 2)

Input the Int Value as 200 Mexican Pesos

US Value = (1/ 9.5085) * 200 = 21.00 US Dollars

Output: “The value of 200 Mexcian Pesos is 21.00 US Dollars”

English Pound (currency 3)

Input the Int_Value as 200 English pound

US Value = (1 / .6085) * 100 = 164.33 US Dollars

Output: “The value of 100 English pounds is 164.33 US Dollars”

French francs (currency 5)

Input the Int_Value as 655 French francs

US Value = (1 / 6.2561) * 655 = 105.00 US Dollars

Output: “The value of 655 French francs is 105.00 US Dollars”

Japanese Yen (currency 4)

Input the Int_Value as 500 Japanese Yen

US Value = (1 / 104.92) * 500 = 4.77 US Dollars

Output: “The value of 500 Japanese Yen is 4.77 US Dollars”

Currency Conversion

International Currency = Japanese Yen

Inputs:

Currency_Type = 4

Int_Value = 500.0

Calculations:

US_Value = 4.77

Expected Output

The value of 500.0 Japanese Yen is 4.77 US dollars

International Currency = Canadian Dollars

Inputs:

Currency_Type = 1

Int_Value = 400.0

Calculations:

US_Value = 272.4

Expected Output

The value of 400.0 Canadian Dollars is 272.4 US dollars

International Currency = Mexican Pesos

Inputs:

Currency_Type = 2

Int_Value = 200.0

Calculations:

US_Value = 21.00

Expected Output

The value of 200.0 Mexican Pesos is 21.00 US dollars

International Currency = English Pounds

Inputs:

Currency_Type = 3

Int_Value = 900.0

Calculations:

US_Value = 1479.04

Expected Output

The value of 900.0 English Pounds is 1479.04 US dollars

International Currency = French francs

Inputs:

Currency_Type = 5

Int_Value = 655.0

Calculations:

US_Value = 105.00

Expected Output

The value of 655.0 French francs is 105.00 US dollars