Week 9: Currency Conversion
Week 6: Currency Conversion Test Procedure
Main Module
Declare selection as integer Declare currencyType as Integer Declare internationalValue as Real
Declare US Value as Real
Declare currency as string
Declare continue as Boolean
Set continue to true
Call Display_Menu module End Main Module
Display_Menu Module
While continue=true
Display "Welcome to the international currency conversion program :-" Display "Below are the following conversion choices" 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 "Choose from 1 to 6:" Input currencyType
While currencyType < 1 AND currencyType > 6
Display”Make a valid selection between 1 to 6”
Input currencyType
End While
If currencyType > 1 AND currencyType <5
Call Get_Int_Value Module (currencyType)
End If
else
If currencyType = 6 Then
Display”Exiting the program.Goodbye!”
Set continue to false
End If
End While
End Display_Menu Module
Get_Int_Value Module(currencyType)
Define internationalValue as Real
Declare option = currencyType
Display”Enter the Amount to convert”
Input internationalValue
While internationalValue <0
Display”Enter a positive amount”
Input internationalValue
End While
Call Convert_Currency Module (internationalValue,option)
End Get_Int_Value Module
Convert_Currency Module(internationalValue,option)
Define Rate as Real
Define US Value as Real
Define currency as string
Declare Amount = internationalValue
Declare CurrencyType = option
If CurrencyType = 1 then
rate = 0.93
Currency = Canadian dollars
End if
Else If CurrencyType = 2 then
rate = 0.077
Currency = Mexican Pesos
End if
Else If CurrencyType = 3 then
rate = 1.71
Currency = English Pounds
End if
Else If CurrencyType = 4 then
rate = 0.0099
Currency =Japanese yen
End if
Else If CurrencyType = 5 then
rate = 1.11
Currency =French francs
End if
Else
rate = 1.0
US Value = Amount * rate
Call Display_Results Module
End Convert_Currency Module
Display_Results Module
Display "The value of ", internationalValue, " ", currency, " is ", US Value, " US dollars"
End Display_Results Module
Display_Menu Test Cases
|
|
Test Input for Currency Type |
Expected Output and comments |
|
Test Case 1 |
A number between 1 to 5 |
No error. Appropriate modules are called. User is asked for currency type and amount. Currency is converted to USD and displayed. |
|
Test Case 2 |
A number greater than 6 or less than 6 |
Error message” Make a valid selection between 1 to 6” |
|
Test Case 3 |
A number equal to 6 |
No error. Message “Exiting the program. Goodbye!” .The program ends. |
Get Convert_Currency Module Test Cases
|
|
Test input
|
Expected Output and comments |
|
Test Case 1 |
currencyType = 1 internationalValue = 50 |
The value of 50 Canadian dollars is 34.06 US dollars. |
|
Test Case 2 |
currencyType = 2 internationalValue = 50 |
The value of 50 Mexican pesos is 1.052 US dollars. |
|
Test Case 3 |
currencyType = 3 internationalValue = 50 |
The value of 50 English Pounds is 82.165 US dollars. |
|
Test Case 4 |
currencyType = 4 internationalValue = 50 |
The value of 50 Japanese yen is 0.477 US dollars. |
|
Test Case 5 |
currencyType = 5 internationalValue = 50 |
The value of 50 French francs is 7.993 US dollars. |
|
Test Case 6 |
For Any currency type with international value negative |
Error message ”Enter a positive amount” Message appears till positive value is entered |
Currency Conversion Integration test
|
|
Test input
|
Expected Output and comments |
|
Test Case 1 |
A very large number e/g currencyType = 1 internationalValue = 5000000000000000 |
The value of 5000000000000000 Canadian dollars is 3405994550408719.346 US dollars. |
|
Test Case 2 |
Boundary condition currencyType = 2 internationalValue = 0 |
The value of 0 Mexican pesos is 0 US dollars. |
|
Test Case 3 |
Nonsense value say a string like xyz either for currencyType or international value which are numbers |
Error by the processor stating strings can’t be assigned to integers or real numbers |
Display_Menu Test Cases
|
|
Test Input for Currency Type |
Expected Output and comments |
|
Test Case 1 |
A number between 1 to 5 |
No error. Appropriate modules are called. User is asked for currency type and amount. Currency is converted to USD and displayed. |
|
Test Case 2 |
A number greater than 6 or less than 6 |
Error message” Make a valid selection between 1 to 6” |
|
Test Case 3 |
A number equal to 6 |
No error. Message “Exiting the program. Goodbye!” .The program ends. |
Get_Int_value module Test Cases
|
|
Test input
|
Expected Output and comments |
|
Test Case 1 |
Enter a negative value for amount say -6. |
Error message ”Enter a positive amount” |
|
Test Case 2 |
Enter an integer value say 1000 with CurrencyType 1 i.e Canadian dollars |
Get values converted in US dollar. The converted Us dollar value would be 681.199 |
|
Test Case 3 |
Enter an float/real value say 120.50 with CurrencyType 3 i.e English pounds |
Get values converted in US dollar. The converted Us dollar value would be 198.01765 |
|
Test Case 4 |
Enter a value 0.Doesn’t matter which Currency type. |
Output value is 0 always |
Get Convert_Currency Module Test Cases
|
|
Test input
|
Expected Output and comments.Value assigned to US value variable |
|
Test Case 1 |
currencyType = 1 internationalValue = 50 |
US Value is assigned value 34.06. |
|
Test Case 2 |
currencyType = 2 internationalValue = 50 |
US Value is assigned value 1.052 |
|
Test Case 3 |
currencyType = 3 internationalValue = 50 |
US value is assigned value 82.165 |
|
Test Case 4 |
currencyType = 4 internationalValue = 50 |
US value is assigned value 0.477 |
|
Test Case 5 |
currencyType = 5 internationalValue = 50 |
US value is assigned value 7.993 |
|
Test Case 6 |
For Any currency type with international value negative |
Variable is not assigned any value as Convert_Currency module is not implemented |
Get Convert_Currency Module Test Cases
|
|
Test input
|
Expected Output and comments |
|
Test Case 1 |
currencyType = 1 internationalValue = 50 |
The value of 50 Canadian dollars is 34.06 US dollars. |
|
Test Case 2 |
currencyType = 2 internationalValue = 50 |
The value of 50 Mexican pesos is 1.052 US dollars. |
|
Test Case 3 |
currencyType = 3 internationalValue = 50 |
The value of 50 English Pounds is 82.165 US dollars. |
|
Test Case 4 |
currencyType = 4 internationalValue = 50 |
The value of 50 Japanese yen is 0.477 US dollars. |
|
Test Case 5 |
currencyType = 5 internationalValue = 50 |
The value of 50 French francs is 7.993 US dollars. |
|
Test Case 6 |
For Any currency type with international value negative |
Error message ”Enter a positive amount” Message appears till positive value is entered |
Currency Conversion Integration test
|
|
Test input
|
Expected Output and comments |
|
Test Case 1 |
A very large number e/g currencyType = 1 internationalValue = 5000000000000000 |
The value of 5000000000000000 Canadian dollars is 3405994550408719.346 US dollars. |
|
Test Case 2 |
Boundary condition currencyType = 2 internationalValue = 0 |
The value of 0 Mexican pesos is 0 US dollars. |
|
Test Case 3 |
Nonsense value say a string like xyz either for currencyType or international value which are numbers |
Error by the processor stating strings can’t be assigned to integers or real numbers |