Florence Sanders
IT/210 Fundamentals of Programming with Algorithms and Logic
September 16, 2012
Ed Addison
Application-Level Requirements List
1. User screen that prompts user
2. Display prompts main user title screen
3. Main user screen provides short description explaining use of program
4. Calculations of currency is executed with valid inputs
5. Provides option to clear input fields
Input | Process | Output | Currency TypeCurrency AmountExchange Rate | Get user input | Currency Type Currency Amount | Currency Type | Foreign Exchange Currency | Currency Type | Enter currency amount | Calculate total | Currency Amount | Foreign Currency amount | …show more content…
Convert to US dollar | US currency amount | Currency TypeCurrency AmountExchange Rate | Display results | Conversion of foreign currency into US Dollars |
Main Module
Main Module
Display_Resluts Module
Display_Resluts Module
Get_Int_Value Module
Get_Int_Value Module
Display_Menu Module
Display_Menu Module
Convert_Currency Module
Convert_Currency Module
Control Flow Diagram—Main Control
-------------------------------------------------
Begin
Display Menu Quit
?
Provide exit message Display Menu
Yes
No
Convert Currency
Display results
End
Begin
Display Menu Quit
?
Provide exit message Display Menu
Yes
No
Convert Currency
Display results
End
-------------------------------------------------
Control Flow Diagram—Display Menu
Begin
Selection menu
Valid selection ?
Error
4
:
Invalid menu selection
No
Yes
End
Quit
?
Yes
Provide exit menu
Quit
Verified
?
Yes
Take selection from user
Get_Int_Value
No
Conversion
Verified
?
No
Yes
No
Begin
Selection menu
Valid selection ?
Error
4
:
Invalid menu selection
No
Yes
End
Quit
?
Yes
Provide exit menu
Quit
Verified
?
Yes
Take selection from user
Get_Int_Value
No
Conversion
Verified
?
No
Yes
No |
Control Flow Diagram—Get_Int_Value
Tell user to enter number
Tell user to enter number
Take input from user
Take input from user
Error message
Error message
Error message
Error message
|
Control Flow Diagram—Convert Currency
French
?
French
?
Japanese? ?
Japanese?
?
Mexican?
Mexican?
Begin
Canadian
?
Rate=Canadian Rate
English
?
No
No
No
No
No Yes
Yes
Yes
Yes
Yes
Rate =Mexican rate
Rate=pound rate
Rate=Japanese rate
Rate
=
French Rate
Rate
=
0
.
0
US Value
=
Rate*Int_Value
End Begin
Canadian
?
Rate=Canadian Rate
English
?
No
No
No
No
No Yes
Yes
Yes
Yes
Yes
Rate =Mexican rate
Rate=pound rate
Rate=Japanese rate
Rate
=
French Rate
Rate
=
0
.
0
US Value
=
Rate*Int_Value
End |
Control Flow Diagram—Display_Results
Nation=French
Currency=Francs
Nation=French
Currency=Francs
Nation=Japanese
Currency=Yen
Nation=Japanese
Currency=Yen
Nation=English
Currency=Pound
Nation=English
Currency=Pound
Nation=Mexican
Currency=Pesos
Nation=Mexican
Currency=Pesos
Japanese
?
Japanese
?
English
?
?
English
?
?
Mexican
?
Mexican
?
Canadian ?
Canadian ?
Invalid Selection
Invalid Selection
|
Final Project Currency Conversion
Psuedocode
Main Module
Declare selection as integer
Declare currency Type as Integer
Declare international Value as real
Declare US Value 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 “Welcome to the international currency conversion program” Display “Please make a selection” Display “international Currency Types:” 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 Currency Type
If Currency Type >= 1 AND currency Type <= 5 then Set continue = false Else if currency Type = 6 Display “Quitting Currency Conversion” Continue = false Else Display “Error 1: 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 international Value if international Value > 0 AND international Value <=(NNN) NNN- NNNNthen continue = false else Display“"Error 2: Invalid input--Negative Number" continue = true end if
end while
End Get International Value
Convert Currency
Declare rate as real
Select Case of currency Type case 1: Set rate = 1.4680 case 2: Set rate = 9.5085 case 3: Set rate = 1.6433 case 4: Set rate =(NNN) NNN-NNNN case 5: Set rate = 6.2561 default: Set rate = 0.0
End Case
US Value = rate * international Value
End Convert Currency
Display Results
Declare nation as string
Declare currency as string
Select Case of currency Type 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 “, international Value, “ “ , nation, “ “, currency, “ is “, US Value, “ dollars” else Display "Error3: Invalid Selection." end if
End Display Results
Test Cases
Display Menu Test Cases
Test Case 1: Valid Menu Selection = Canadian Dollars
Inputs: Menu Selection = 1
Expected Outputs:
“Do you want to continue with the conversion, Y = Yes, N = No”
Currency type = 1
Test Case 2: Valid Menu Selection = Quit
Inputs: Menu Selection = 6
Expected Outputs:
“Do you want to Quit, Y = Yes, N = No”
Currency type = 1
Test Case 3: Invalid Menu Selection = 9
Inputs: Menu Selection = 9
Expected Outputs:
“Error 4: Please make a valid menu selection”
“Hit any character or number to continue”
Menu is redisplayed
Get_Int_Value Test
Test Case 1: Valid International Value = 100.0
Inputs: 100.0
Expected Outputs:
International Value = 100.0
Test Case 2: Valid International Value = 0.0
Inputs: 0.0
Expected Outputs:
International Value = 00.0
Test Case 3: Invalid International Value = -15
Inputs: -15
Expected Outputs:
Error 1: Invalid input—Negative Number
Strike any character or numeric key to continue
Test Case 4: Illegal International value = character input
Input: ”L”
Expected Outputs:
Error 2: Illegal Input, Strike any character or numeric key to continue
Convert Currency Test
Test Case 1: Valid International Currency = Canadian
Inputs:
Currency type = 1
International value = 100.0
Expected Output
US value = 68.12
Test Case 2: Valid International Currency = Mexican
Inputs:
Currency type = 2
International value = 100.0
Expected Output
US value = 10.52
Test Case 3: Valid International Currency = English
Inputs:
Currency_Type = 3
Int_Value = 100.0
Expected Output
US_Value = 164.83
Test Case 4: Valid International Currency = Japanese
Inputs:
Currency_Type = 4
Int_Value = 100.0
Expected Output
US_Value = 0.95
Test Case 5: Valid International Currency = French
Inputs:
Currency_Type = 5
Int_Value = 100.0
Expected Output
US_Value = 15.98
Test Case 6: Invalid International Currency = 6
Inputs:
Currency_Type = 6
Int_Value = 100.0
Expected Output
US_Value = 0.0
Display Results Test Cases
Test Case 1: Valid International Currency = Canadian
Inputs:
Currency_Type = 1
Int_Value = 100.0
US_Value = 68.12
Expected Output
The value of 100.0 Canadian dollars is 68.12 US dollars
Test Case 2: Valid International Currency = Mexican
Inputs:
Currency_Type = 2
Int_Value = 100.0
US_Value = 10.52
Expected Output
The value of 100.0 Mexican Pesos is 10.52 US Dollars
Test Case 3: Valid International Currency = English
Inputs:
Currency_Type = 3
Int_Value = 100.0
US_Value = 164.83
Expected Output
The value of 100.0 English pounds is 164.33 US dollars
Test Case 4: Valid International Currency = Japanese
Inputs:
Currency_Type = 4
Int_Value = 100.0
US_Value = 0.95
Expected Output
The value of 100.0 Japanese Yes is 0.94 US dollars
Test Case 5: Valid International Currency = French
Inputs:
Currency_Type = 5
Int_Value = 100.0
US_Value = 15.98
Expected Output
The value of 100.0 French Francs is 15.98 US dollars
Test Case 6: Invalid International Currency = 6
Inputs:
Currency_Type = 6
Int_Value = 100.0
US_Value = 0.0
Expected Output
Error 5: Invalid Currency Type
Currency Conversion Integration Test
Test Case 1: Valid Selection = Canadian
Inputs:
Currency_Type = 1
Int_Value = 100.0
US_Value = 68.12
Expected Output
The value of 100.0 Canadian dollars is 68.12 US dollars
Test Case 2: Valid Selection = Quit
Inputs:
Currency_Type = 6
Continue = ”n”
Expected Output
Thank you for using the Currency Conversion Program
Test Case 3: Illegal Currency Amount
Inputs:
Currency_Type = 1
Int_Value = ”L”
Outputs
Error 2: Illegal Input
Strike any character or numeric key to continue