Professional Documents
Culture Documents
1. The program shall present a series of user screens that prompts the user for specified input. 2. The main user screen shall have an application title. 3. The main user screen shall have a short description telling the user how to use the program. 4. The calculation of the currency shall be executed only after all the valid input values are provided. 5. The program shall allow the user to clear all input fields and recomplete the calculation.
Input-Process-Output Chart
Input Name: Type: Range: Name: International Value Type: Real Range: 0-1,000,000 Name: International Value Type: Real Range: 0-1,000,000 Name: Currency Type Type: Integer Range: 1-6 Name: Currency Type Type: Integer Range: 1-6 Name: International Value Type: Real Range: 0-1,000,000 Name: US Value Type: Real Range: > 0 Display Results Name: Currency Type Type: Integer Range: 1-6 Name: International Value Type: Real Range: 0-1,000,000 Name: US Value Type: Real Range: > 0 Process Display Menu Output Name: Currency Type Type: Integer Range: 1-6 Name: International Value Type: Real Range: 0-1,000,000 Name: US Value Type: Real Range: > 0
Convert Currency
Hierarchy Chart
Currency Conversion
Display_Menu
Get_Int_Value
Convert_Currency
Display_Results
FlowCharts
Control Flow DiagramMainModule Begin
DisplayMenu
Yes
Quit ?
No
End
GetIntValue
ConvertCurrency
DisplayResults
Begin
Input currencyType
No
Quit ?
Yes
Quit Verified? No
No
Yes End
Begin
Input internationalValue
Yes
Yes
Valu
No
Valu e =
No
Yes
End
Begin
Yes
Rate = 0.0009
Yes
Rate = 0.3244
End
Begin
SouthKorean?
Malaysia?
Chinese
Aust ralia
Turkish
End
Pseudocode
MainModule Declare Declare Declare Declare currencyType as Integer internationalValue as real USValue as real quit as Boolean
Set quit = false Do While quit = false Display Menu If quit = false Call GetIntValue Call ConvertCurrency Call DisplayResults End if End loop Print exit message End MainModule DisplayMenu Declare continue as Boolean Declare exitResponse as string 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: South Korean Won" Display "2: Malaysian Ringget" Display "3: Chinese Yuan" Display "4: Australian Dollar" Display "5: Turkish Lira" Display "6: Quit" Display "Enter a selection: "; Input currencyType If currencyType => 1 or =<5 Call ConvertCurrency Else If currenyType = 6 Set continue = false Quit Endif End DisplayMenu GetIntValue Declare continue as Boolean
Set continue = true While continue = true Display "Enter a currency value (positive number):" Input internationalValue If internationalValue = > 1000000 Display Error 1: Currency value must be less than 1000000. Set continue = false Else If internationalValue < 0 Display Error 2: Currency value must be positive. Set continue = false Else If internationalValue = 0 Display Error 3: Currency value must be greater than 0. Set continue = false Else Call ConvertCurrency Endif EndWhile End GetIntValue ConvertCurrency Declare Rate as Integer Declare Result as Integer Set continue = true If currencyType = 1 Set Rate = 0.0009 Else If currencyType = 2 Set Rate = 0.3244 Else If currencyType = 3 Set Rate = 0.1584 Else If currencyType = 4 Set Rate = 1.0556 Else If currencyRate = 5 Set Rate = 0.5495 Endif Set Result = internationalValue * Rate End ConvertCurrency DisplayResults If currencyType = 1 Display Nation = South Korea Display Currency = Won Display internationalValue Display US Dollar Value = Result Else
If currencyType = 2 Display Nation = Malaysia Display Currency = Ringget Display internationalValue Display US Dollar Value = Result Else If currencyType = 2 Display Nation = Chinese Display Currency = Yuan Display internationalValue Display US Dollar Value = Result Else If currencyType = 2 Display Nation = Australian Display Currency = Dollar Display internationalValue Display US Dollar Value = Result Else If currencyType = 2 Display Nation = Turkish Display Currency = Lira Display internationalValue Display US Dollar Value = Result EndIf Call DisplayMenu End DisplayResults
Test Cases
DisplayMenu Test Cases Test Case 1: Valid Menu Selection = South Korean won Inputs: Menu Selection = 1 Expected Outputs: currencyType = 1 Test Case 2: Valid Menu Selection = Quit Inputs: Menu Selection = 6 Expected Outputs: Are you sure you want to exit? Enter Y to exit. Test Case 3: Invalid Menu Selection = 9 Inputs: Menu Selection = 9 Expected Outputs:
Error 4: Invalid currency type Menu is redisplayed GetIntValue Test Cases Test Case 1: Valid International Value = 1000.00 Inputs: 1000.00 Expected Outputs: internationalValue = 1000.00 Test Case 2: Valid International Value = 0.0 Inputs: 0.00 Expected Outputs: Error 3: Invalid inputCurrency value equal to zero Test Case 3: Invalid International Value = -15 Inputs: -15.00 Expected Outputs: Error 1: Invalid input--Negative currency value Test Case 4: Invalid International Value = 1,000,001.00 Inputs: 1000001.00 Expected Outputs: Error 2: Invalid inputCurrency value too large Test Case 5: Illegal International value = character input Inputs: L Expected Outputs: Program error; internationalValue is defined as a real number, so it will not accept character input. ConvertCurrency Test Cases Test Case 1: Valid International Currency = South Korean Inputs: currencyType = 1 internationalValue = 1000.00 Expected Output:
USValue = 0.90 Test Case 2: Valid International Currency = Malaysian Inputs: currencyType = 2 internationalValue = 1000.00 Expected Output: USValue = 324.40 Test Case 3: Valid International Currency = Chinese Inputs: currencyType = 3 internationalvalue = 1000.00 Expected Output: USValue = 158.40 Test Case 4: Valid International Currency = Australian Inputs: currencyType = 4 internationalValue = 1000.00 Expected Output: USValue = 1055.60 Test Case 5: Valid International Currency = Turkish Inputs: currencyType = 5 internationalValue = 1000.00 Expected Output: USValue = 549.50 DisplayResults Test Cases Test Case 1: Valid International Currency = South Korean Inputs: currencyType = 1 internationalValue = 1000.00 USValue = 0.90 Expected Output: The value of 1000.00 South Korean won is 0.90 U.S. dollars Test Case 2: Valid International Currency = Malaysian Inputs: currencyType = 2 internationalValue = 1000.00 USValue = 324.40
Expected Output: The value of 1000.00 Malaysian ringgets is 324.40 U.S. dollars Test Case 3: Valid International Currency = Chinese Inputs: currencyType = 3 internationalValue = 1000.00 USValue = 158.40 Expected Output: The value of 1000.00 Chinese yuan is 158.40 U.S. dollars Test Case 4: Valid International Currency = Australian Inputs: currencyType = 4 internationalValue = 1000.00 USValue = 1055.60 Expected Output: The value of 1000.00 Australian dollars is 1055.60 U.S. dollars Test Case 5: Valid International Currency = Turkish Inputs: currencyType = 5 internationalValue = 1000.00 USValue = 549.50 Expected Output: The value of 1000.00 Turkish lira is 549.50 U.S. dollars Currency Conversion Integration Test Cases Test Case 1: Valid Selection = South Korean Inputs: currencyType = 1 internationalValue = 1000.00 USValue = 0.90 Expected Output: The value of 1000.00 South Korean won is 0.90 U.S. dollars Test Case 2: Valid Selection = Quit Inputs: currencyType = 6 continue = n Expected Output: Thank you for using the Currency Conversion Program
Test Case 3: Illegal Currency Amount Inputs: currencyType = 1 internationalValue = -15.00 Expected Output: Error 1: Invalid input--Negative currency value