IT210 Final Project

15
Application-Level Requirements List 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.

description

Final project for UOP online class IT210

Transcript of IT210 Final Project

Page 1: IT210 Final Project

Application-Level Requirements List1. 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.

Page 2: IT210 Final Project

Input-Process-Output ChartInput Process Output

Name:Type:

Range:

Display Menu Name:

Type:Range

:

Currency TypeInteger1-6

Name:Type:

Range:

International ValueReal0-1,000,000

Get Intl Value Name:

Type:Range

:

International ValueReal0-1,000,000

Name:Type:

Range:

Name:Type:

Range:

International ValueReal0-1,000,000

Currency TypeInteger1-6

Convert Currency

Name:

Type:Range

:

US ValueReal> 0

Name:Type:

Range:

Name:Type:

Range:

Name:Type:

Range:

Currency TypeInteger1-6

International ValueReal0-1,000,000

US ValueReal> 0

Display Results Name:

Type:Range

:

Name:

Type:Range

:

Name:

Type:Range

:

Currency TypeInteger1-6

International ValueReal0-1,000,000

US ValueReal> 0

Hierarchy Chart

Page 3: IT210 Final Project

FlowChartsControl Flow Diagram—MainModule

Currency Conversion

Display_Menu Get_Int_Value Convert_Currency Display_Results

En

DisplayResults

No

Yes

GetIntValue

messaDisplay ?Qui

DisplayMenu

Begi

Page 4: IT210 Final Project

Control Flow Diagram—DisplayMenu

Begin

Set continue = Ture

Valid Selection?

Error 4: Invalid menu selection No

Yes

End

Quit? YesSet continue = false

Quit Verified?

Yes

Input currencyType

No

No

Page 5: IT210 Final Project

Control Flow Diagram—GetIntValue

No

No

No

Yes

Yes

Yes

Begin

Val

Value

End

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

Input internationalValue

Error 1: Currency value must be less than

Error 2: Currency value must be positive.

Error 3: Currency value must be greater than 0.

Value >

Page 6: IT210 Final Project

Control Flow Diagram—ConvertCurrency

Begin

South Korean? Rate = 0.0009

Chinese?

No

No

No

No

Yes

Yes

Yes

Yes

Yes

Rate = 0.3244

malaysi

Rate = 0.1584

Rate = 1.0556

Rate = 0.5495

End

US Value = Rate * IntValue

Malaysian

Australian

Turkish

Page 7: IT210 Final Project

Control Flow Diagram—DisplayResults

Begin

Australi

Nation = South KoreaCurrency = Won

Nation = MalaysiaCurrency = Ringget

Nation = ChineseCurrency = Yuan

Nation = AustralianCurrency = Dollar

Nation = TurkishCurrency = Lira

End

display conversion results

SouthKorean?

Malaysia?

Chinese

Turkish

Page 8: IT210 Final Project

PseudocodeMainModule

Declare currencyType as IntegerDeclare internationalValue as realDeclare USValue as realDeclare quit as Boolean

Set quit = false

Do While quit = falseDisplay MenuIf quit = false

Call GetIntValueCall ConvertCurrencyCall DisplayResults

End ifEnd loopPrint exit message

End MainModule

DisplayMenu

Declare continue as BooleanDeclare exitResponse as stringSet continue = true

While continue = trueDisplay "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 currencyTypeIf currencyType => 1 or =<5

Call ConvertCurrencyElse

If currenyType = 6Set continue = falseQuit

Endif

End DisplayMenu

GetIntValue

Page 9: IT210 Final Project

Declare continue as BooleanSet continue = true

While continue = trueDisplay "Enter a currency value (positive number):"Input internationalValue

If internationalValue = > 1000000Display “Error 1: Currency value must be less than

1000000.”Set continue = falseElse

If internationalValue < 0Display “Error 2: Currency value must be positive.“Set continue = false

ElseIf internationalValue = 0Display “Error 3: Currency value must be greater than 0.”Set continue = false

ElseCall ConvertCurrency

Endif

EndWhile

End GetIntValue

ConvertCurrency

Declare Rate as IntegerDeclare Result as IntegerSet continue = true

If currencyType = 1Set Rate = 0.0009

ElseIf currencyType = 2Set Rate = 0.3244

ElseIf currencyType = 3Set Rate = 0.1584

ElseIf currencyType = 4Set Rate = 1.0556

ElseIf currencyRate = 5Set Rate = 0.5495

EndifSet Result = internationalValue * Rate

End ConvertCurrency

DisplayResults

If currencyType = 1Display “Nation = South Korea”

Page 10: IT210 Final Project

Display “Currency = Won”Display internationalValueDisplay “US Dollar Value = Result”Else

If currencyType = 2Display “Nation = Malaysia”Display “Currency = Ringget”Display internationalValueDisplay “US Dollar Value = Result”

ElseIf currencyType = 2

Display “Nation = Chinese”Display “Currency = Yuan”Display internationalValueDisplay “US Dollar Value = Result”

ElseIf currencyType = 2

Display “Nation = Australian”Display “Currency = Dollar”Display internationalValueDisplay “US Dollar Value = Result”

ElseIf currencyType = 2

Display “Nation = Turkish”Display “Currency = Lira”Display internationalValueDisplay “US Dollar Value = Result”

EndIfCall DisplayMenu

End DisplayResults

Test CasesDisplayMenu Test Cases

Test Case 1: Valid Menu Selection = South Korean wonInputs:

Menu Selection = 1

Expected Outputs: currencyType = 1

Test Case 2: Valid Menu Selection = QuitInputs:

Menu Selection = 6

Expected Outputs: “Are you sure you want to exit? Enter ‘Y’ to exit.”

Test Case 3: Invalid Menu Selection = 9

Page 11: IT210 Final Project

Inputs: Menu Selection = 9

Expected Outputs:

“Error 4: Invalid currency type” Menu is redisplayed

GetIntValue Test Cases

Test Case 1: Valid International Value = 1000.00Inputs:

1000.00

Expected Outputs:internationalValue = 1000.00

Test Case 2: Valid International Value = 0.0Inputs:

0.00

Expected Outputs:“Error 3: Invalid input—Currency value equal to zero”

Test Case 3: Invalid International Value = -15Inputs:

-15.00

Expected Outputs:“Error 1: Invalid input--Negative currency value”

Test Case 4: Invalid International Value = 1,000,001.00Inputs:

1000001.00

Expected Outputs:“Error 2: Invalid input—Currency value too large”

Test Case 5: Illegal International value = character inputInputs:

”L”

Expected Outputs:Program error; internationalValue is defined as a real

number, so it willnot accept character input.

ConvertCurrency Test Cases

Test Case 1: Valid International Currency = South Korean

Page 12: IT210 Final Project

Inputs:currencyType = 1internationalValue = 1000.00

Expected Output:USValue = 0.90

Test Case 2: Valid International Currency = MalaysianInputs:

currencyType = 2internationalValue = 1000.00

Expected Output:USValue = 324.40

Test Case 3: Valid International Currency = ChineseInputs:

currencyType = 3internationalvalue = 1000.00

Expected Output:USValue = 158.40

Test Case 4: Valid International Currency = AustralianInputs:

currencyType = 4internationalValue = 1000.00

Expected Output:USValue = 1055.60

Test Case 5: Valid International Currency = TurkishInputs:

currencyType = 5internationalValue = 1000.00

Expected Output:USValue = 549.50

DisplayResults Test Cases

Test Case 1: Valid International Currency = South KoreanInputs:

currencyType = 1internationalValue = 1000.00USValue = 0.90

Page 13: IT210 Final Project

Expected Output:The value of 1000.00 South Korean won is 0.90 U.S.

dollars

Test Case 2: Valid International Currency = MalaysianInputs:

currencyType = 2internationalValue = 1000.00USValue = 324.40

Expected Output:The value of 1000.00 Malaysian ringgets is 324.40 U.S.

dollars

Test Case 3: Valid International Currency = ChineseInputs:

currencyType = 3internationalValue = 1000.00USValue = 158.40

Expected Output:The value of 1000.00 Chinese yuan is 158.40 U.S.

dollars

Test Case 4: Valid International Currency = AustralianInputs:

currencyType = 4internationalValue = 1000.00USValue = 1055.60

Expected Output:The value of 1000.00 Australian dollars is 1055.60 U.S.

dollars

Test Case 5: Valid International Currency = TurkishInputs:

currencyType = 5internationalValue = 1000.00USValue = 549.50

Expected Output:The value of 1000.00 Turkish lira is 549.50 U.S. dollars

Currency Conversion Integration Test Cases

Page 14: IT210 Final Project

Test Case 1: Valid Selection = South KoreanInputs:

currencyType = 1internationalValue = 1000.00USValue = 0.90

Expected Output:The value of 1000.00 South Korean won is 0.90 U.S.

dollars

Test Case 2: Valid Selection = QuitInputs:

currencyType = 6continue = ”n”

Expected Output:Thank you for using the Currency Conversion Program

Test Case 3: Illegal Currency AmountInputs:

currencyType = 1internationalValue = -15.00

Expected Output:“Error 1: Invalid input--Negative currency value”