Running head: CURRENCY CONVERSION 1

Currency Conversion

Billy Burger

IT-210

April 29, 2012

WALLY PISTONE CURRENCY CONVERSION 2

Currency Conversion

~Application-Level Requirements List~

1. Menu-Driven Program

2. User has option to select 1 of 5 international currency types. (Canadian dollars, Mexican pesos, English pounds, Japanese yen, and French francs)

3. Program converts foreign currency to U.S. dollars if values provided are valid.

4. Program displays the equivalent dollar amount.

5. Program returns to main menu, user has option to enter another conversion or quit the program.

~Input-Process-Output Chart~

Input Process Output

Menu Options: User selects 1 of 6

Display Menu Currency Type (Integer) 1 - 5

International Value (Real) 0 - 1,000,000

Get Foreign Value Int_Value (Real) 0 - 1,000,000

Currency Type (Integer) 1 - 5

International Value (Real) 0 - 1,000,000

Convert Currency US_Value (Real) > 0 CURRENCY CONVERSION 3

Currency Type (Integer) 1 - 5

International Value (Real) 0 - 1,000,000

US_Value (Real) > 0

Display Results Currency Type (Integer) 1 - 5

Int_Value (Real) 0 - 1,000,000

US_Value (Real) > 0

~Hierarchy Chart~

~Control Flow Diagram—Main Control~

~Control Flow Diagram—Display Menu~

~Control Flow Diagram—Get Foreign Value~ CURRENCY CONVERSION 4

~Control Flow Diagram—Convert Currency~

~Control Flow Diagram—Display Results~

~Pseudocode~

Main Control

Declare Nation As String

Write "Welcome to the Currency Conversion Program"

Write

Write "This program coverts foreign currency to US dollars."

Repeat

Call Display Menu

If Selection = 1 Then

Set Nation = Canadian CURRENCY CONVERSION 5

End If

If Selection = 2 Then

Set Nation = Mexican

End If

If Selection = 3 Then

Set Nation = English

End If

If Selection = 4 Then

Set Nation = Japanese

End If

If Selection = 5 Then

Set Nation = French

End If

Until Selection = 0

If Selection = 0 Then

Write "Thank you for using the Currency Conversion Program"

End Program

End If

Call Get Foreign Value

Call Convert Currency

Call Display Results

End Main Control

Display Menu CURRENCY CONVERSION 6

Declare Selection As Integer

Repeat

Write "Select Foreign Currency"

Write ""

Write "0 - Quit The Program"

Write "1 - Canadian Dollars"

Write "2 - Mexican Pesos"

Write "3 - English Pounds"

Write "4 - Japanese Yen"

Write "5 - French Francs"

Input Selection

If Selection = 0 Then

Repeat

Write "Are you sure you want to quit program? (Y or N)"

Input Response

If Response = N Then

Call Display Menu

If Response = Y Then

Set Selection = 0

Until Response = N or Response = Y

Else If Selection < 0 Or Selection > 5

Write "Error 4: Invalid Menu Selection"

End If

Until (Selection = Int(Selection)) And (Selection > = 0) And (Selection < = 5) CURRENCY CONVERSION 7

End Display Menu

Get Foreign Value

Declare Int_Value As Real

Repeat

Write "Enter Foreign Value"

Write "Value Must Be A Positive Number"

Input Int_Value

If Int_Value < = 0 Or > 1,000,000 Then

Write "Error 1: Invalid Input"

Write "Value Must Be A Positive Number"

Else If Int_Value < > Real

Write "Error 2: Illegal Value

Write "Value Must Be A Number"

End If

Until Int_Value > 0 And < 1,000,000

End Get Foreign Value

Convert Currency

Declare US_Value, Rate As Real

Select Case Of Nation

Case Canadian: CURRENCY CONVERSION 8

Set Rate = 1.4680

Case Mexican:

Set Rate = 9.5085

Case English:

Set Rate = 0.6085

Case Japanese:

Set Rate = 104.9200

Case French:

Set Rate = 6.2561

Default:

Set Rate = 0.0

End Case

Set US_Value = Rate * Int_Vale

End Convert Currency

Display Results

Declare Currency As String

Select Case Of Nation

Case Canadian:

Set Currency = Dollars

Case Mexican:

Set Currency = Pesos

Case English: CURRENCY CONVERSION 9

Set Currency = Pounds

Case Japanese:

Set Currency = Yen

Case French:

Set Currency = Francs

Default:

Set Currency = " "

End Case

If Currency < > " " Then

Write "The conversion for $ ", Int_Value, " ", Nation, " ", Currency

Write "is $ ", US_Value, "US Dollars."

Else

Write "Error 5: Invalid Currency Type

End If

End Display Results

~Test Case 1~

Display Menu Test: Valid Menu Selection = Canadian

Inputs: Menu Selection = 1

Expected Outputs:

Nation = Canadian

Get Foreign Value Test: Valid International Value (Canadian) = 200.00 CURRENCY CONVERSION 10

Inputs: 200.00

Expected Outputs:

Int_Value = 200.00

Convert Currency Test: Valid International Currency = Canadian

Inputs:

Nation = Canadian

Int_Value = 200.00

Expected Outputs:

US_Value = 293.60

Display Results Test Cases: Valid International Currency = Canadian

Inputs:

Nation = Canadian

Int_Value = 200.00

U.S._Value = 293.60

Expected Output:

The conversion for $ 200.00 Canadian Dollars

is $ 293.60 US Dollars.

Currency Conversion Integration Test: Valid Selection = Canadian CURRENCY CONVERSION 11

Inputs:

Nation = Canadian

Int_Value = 200.00

U.S._Value = 293.60

Expected Output

The conversion for $ 200.00 Canadian Dollars

is $ 293.60 US Dollars.

~Test Case 2~

Display Menu Test: Valid Menu Selection = Mexican

Inputs: Menu Selection = 2

Expected Outputs:

Nation = Mexican

Get Foreign Value Test: Valid International Value (Mexican) = 100.00

Inputs: 100.00

Expected Outputs:

Int_Value = 100.00

Convert Currency Test: Valid International Currency = Mexican

Inputs:

Nation = Mexican CURRENCY CONVERSION 12

Int_Value = 100.00

Expected Outputs:

US_Value = 950.85

Display Results Test Cases: Valid International Currency = Mexican

Inputs:

Nation = Mexican

Int_Value = 100.00

U.S._Value = 950.85

Expected Output:

The conversion for $ 100.00 Mexican Pesos

is $ 950.85 US Dollars.

Currency Conversion Integration Test: Valid Selection = Mexican

Inputs:

Nation = Mexican

Int_Value = 100.00

U.S._Value = 950.85

Expected Output

The conversion for $ 100.00 Mexican Pesos

is $ 950.85 US Dollars.

~Test Case 3~ CURRENCY CONVERSION 13

Display Menu Test: Valid Menu Selection = English

Inputs: Menu Selection = 3

Expected Outputs:

Nation = English

Get Foreign Value Test: Valid International Value (English) = 100.00

Inputs: 100.00

Expected Outputs:

Int_Value = 100.00

Convert Currency Test: Valid International Currency = English

Inputs:

Nation = English

Int_Value = 100.00

Expected Outputs:

US_Value = 60.85

Display Results Test Cases: Valid International Currency = English

Inputs:

Nation = English CURRENCY CONVERSION 14

Int_Value = 100.00

U.S._Value = 60.85

Expected Output:

The conversion for $ 100.00 English Pounds

is $ 60.85 US Dollars.

Currency Conversion Integration Test: Valid Selection = English

Inputs:

Nation = English

Int_Value = 100.00

U.S._Value = 60.85

Expected Output

The conversion for $ 100.00 English Pounds

is $ 60.85 US Dollars.

~Test Case 4~

Display Menu Test: Valid Menu Selection = Japanese

Inputs: Menu Selection = 4

Expected Outputs:

Nation = Japanese

Get Foreign Value Test: Valid International Value (Japanese) = 100.00 CURRENCY CONVERSION 15

Inputs: 100.00

Expected Outputs:

Int_Value = 100.00

Convert Currency Test: Valid International Currency = Japanese

Inputs:

Nation = Japanese

Int_Value = 100.00

Expected Outputs:

US_Value = 10,492.00

Display Results Test Cases: Valid International Currency = Japanese

Inputs:

Nation = Japanese

Int_Value = 100.00

U.S._Value = 10,492.00

Expected Output:

The conversion for $ 100.00 Japanese Yen

is $ 10,492.00 US Dollars.

Currency Conversion Integration Test: Valid Selection = Japanese

Inputs: CURRENCY CONVERSION 16

Nation = Japanese

Int_Value = 100.00

U.S._Value = 10,492.00

Expected Output

The conversion for $ 100.00 Japanese Yen

is $ 10,492.00 US Dollars.

~Test Case 5~

Display Menu Test: Valid Menu Selection = French

Inputs: Menu Selection = 5

Expected Outputs:

Nation = French

Get Foreign Value Test: Valid International Value (French) = 100.00

Inputs: 100.00

Expected Outputs:

Int_Value = 100.00

Convert Currency Test: Valid International Currency = French

Inputs:

Nation = French CURRENCY CONVERSION 17

Int_Value = 100.00

Expected Outputs:

US_Value = 625.61

Display Results Test Cases: Valid International Currency = French

Inputs:

Nation = French

Int_Value = 100.00

U.S._Value = 625.61

Expected Output:

The conversion for $ 100.00 French Francs

is $ 625.61 US Dollars.

Currency Conversion Integration Test: Valid Selection = French

Inputs:

Nation = French

Int_Value = 100.00

U.S._Value =

Expected Output

The conversion for $ 100.00 French Francs

is $ 625.61 US Dollars.

~Test Case 6~ CURRENCY CONVERSION 18

Display Menu Test: Valid Menu Selection = Quit The Program

Inputs: Menu Selection = 0

Expected Outputs:

Are you sure you want to quit program? (Y or N)

Inputs: Response = N

Expected Outputs:

Select Foreign Currency

0 - Quit The Program

1 - Canadian Dollars

2 - Mexican Pesos

3 - English Pounds

4 - Japanese Yen

5 - French Francs

Currency Conversion Integration Test: Valid Selection = Quit The Program

Inputs: Menu Selection = 0

Expected Outputs:

Are you sure you want to quit program? (Y or N)

Inputs: Response = N

Expected Outputs:

Select Foreign Currency CURRENCY CONVERSION 19

0 - Quit The Program

1 - Canadian Dollars

2 - Mexican Pesos

3 - English Pounds

4 - Japanese Yen

5 - French Francs

~Test Case 7~

Display Menu Test: Valid Menu Selection = Quit The Program

Inputs: Menu Selection = 0

Expected Outputs:

Are you sure you want to quit program? (Y or N)

Inputs: Response = Y

Expected Outputs:

Set Choice = 0

Thank you for using the Currency Conversion Program

End Program

Currency Conversion Integration Test: Valid Selection = Quit The Program

Inputs: Menu Selection = 0

Expected Outputs: CURRENCY CONVERSION 20

Are you sure you want to quit program? (Y or N)

Inputs: Response = Y

Expected Outputs:

Set Choice = 0

Thank you for using the Currency Conversion Program

End Program

~Test Case 8~

Display Menu Test: Invalid Menu Selection = Error

Inputs: Menu Selection = 7

Expected Outputs:

Error 4: Invalid Menu Selection

Select Foreign Currency

0 - Quit The Program

1 - Canadian Dollars

2 - Mexican Pesos

3 - English Pounds

4 - Japanese Yen

5 - French Francs

Currency Conversion Integration Test: Invalid Menu Selection = Error

Inputs: Menu Selection = 7 CURRENCY CONVERSION 21

Expected Outputs:

Error 4: Invalid Menu Selection

Select Foreign Currency

0 - Quit The Program

1 - Canadian Dollars

2 - Mexican Pesos

3 - English Pounds

4 - Japanese Yen

5 - French Francs

~Test Case 9~

Get Foreign Value Test: Invalid Foreign Value = Error

Inputs: 0

Expected Outputs:

Error 1: Invalid Input

Value Must Be A Positive Number

Enter Foreign Value

Value Must Be A Positive Number

Currency Conversion Integration Test: Invalid Foreign Value = Error

Inputs: 0 CURRENCY CONVERSION 22

Expected Outputs:

Error 1: Invalid Input

Value Must Be A Positive Number

Enter Foreign Value

Value Must Be A Positive Number

~Test Case 10~

Get Foreign Value Test: Illegal Foreign Value = Error

Inputs: Wingding

Expected Outputs:

Error 2: Illegal Value

Value Must Be A Number

Enter Foreign Value

Value Must Be A Positive Number

Currency Conversion Integration Test: Illegal Foreign Value = Error

Inputs: Wingding

Expected Outputs:

Error 2: Illegal Value

Value Must Be A Number

Enter Foreign Value

Value Must Be A Positive Number CURRENCY CONVERSION 23