# Currency Conversion Isaac D. Samaniego IT 210 Mr.

Mohamed Meky

Requirements .

and then converts the foreign currency to dollars.4680 Canadian dollars) Mexican pesos English pounds Japanese yen French francs (rate: 1 U.S.2561 francs) Menu Convert United States currency to specified foreign currency Convert specified foreign currency to United States currency Application-Level Requirements List .6433 U. dollar = 9.S. dollar = 1. input the amount of a foreign currency.S. International currency type (menu selection) y y y y y Canadian dollars (rate: 1 U. The program displays the equivalent dollar amount and returns the user to the menu until he or she enters another conversion or quits the program.S.Problem: Currency Conversion Description: The Currency Conversion application is a menu-driven program that allows users to select one of five international currency types.S.9200 yen) (rate: 1 U. dollar = 6. dollar = 104.5085 pesos) (rate: 1. dollars = 1 pound) (rate: 1 U.

The calculation should be executed only after all the valid input values are provided. The main user screen will have an application title.1. 2. Input-Process-Output Chart Input Process Output Currency Amount Currency Type Rate Currency Type Currency Amount Foreign Value Currency Amount Currency Type Rate Get user input Enter Foreign Currency Enter Dollar Amount Convert Currency Display Results Currency Amount Currency Type Rate Currency Type Dollar Amount U. 4. 5. The main user screen should have a short description saying how to use the program. 3. The program will present a series of user screens that prompts the user for specified input.S. Value Conversion/Equivalent Dollar Amount . The program will allow the user to clear all the input fields and do the calculations over.

Design Hierarchy Chart Curr cy Conversion Dis lay_Menu Get_Int_Value Convert_Currency Dis lay_Results Flowcharts .

Control Flow Diagram²-Main Control Begin Dis lay_Menu rovide exit message Yes Quit? No End Get Int Value Convert Concurrency Dis lay Results .

Control Flow Diagram²Display Menu Begin List enu ite s Get Selection erif Continue with conversion Quit erifie Conversion erifie Yes o Yes n       rror 4: Inv li enu selection o li selection Yes Quit Yes erif Quit Yes o .

Control Flow Diagram²Get_Int_Value Begin Pro pt for input Get input Yes n ¡ ¡ rror 2: Illeg l v lue o Leg l input Yes li Input o rror 1: Inv li Input .

0 US lue = te*Int lue ¢ ¢ ¢ ¢ ¢ Yes te = exic n te o Yes te = nglish te o Yes te = J p nese te o Yes te = French te o n .Control Flow Diagram²Convert Currency Begin C n i n Yes te = C n i n te o exic n nglish J p nese French te = 0.

US Value No E nd .Control Flow Diagram²Display Results Beg in Canadian ? No Yes Nation = Canadian Currency = Dollars Mexican ? No Yes Nation = Mexican Currency = Pesos E ng lish ? No Yes Nation = E ng lish Currency = Pounds Japanese ? No Yes Nation = Japanese Currency = Yen French ? No Yes Nation = French Currency = Francs Nation = null Currency = null E rror 5: Invalid Currency Type Yes Currency = null? No print Nation. Int_ Value. Currency.

Psuedocode Main Module Declare Nationality as string Declare CurrencyType as integer Declare CurrencyAmount as real Declare USDollar as real Declare QuitProg as string Call Input Module Call Check Module Call Currency Type Module Call Canadian Module Call Mexican Module Call English Module Call Japanese Module Call French Module Call Exit Module Call Output Module Input Module Decleare CurrencyType as integer Display ³Welcome to Currency Converter´ Display ³Please select a type of currency (Enter 1 ± 6)´ Display ³1 Canadian Dollars´ Display ³2 Mexican Pesos´ Display ³3 English Pounds´ Display ³4 Japanese Yen´ Display ³5 French Francs´ Display ³6 Quit´ Input CurrencyType Call Check Module End Input Module .

000 Then Display ³Invalid Amount´ Call Canadian Module Else USDollar = CurrencyAmount * 1.Check Module Declare CurrencyType as integer If CurrencyType < 1 or CurrencyType > 6 Then Display ³Invalid currency selection.4680 Call Output Module End Canadian Module . ³Please Enter Amount of Currency (0-100.000)´ Input CurrencyAmount If CurrencyAmount < 0 or CurrencyAmount > 100. Please try again´ Call Input Module Else Call Currency Type Module End Check Module Currency Type Module Declare CurrencyType as integer If CurrencyType = 1 Then Call Canadian Module Else If CurrencyType = 2 Then Call Mexican Module Else If CurrencyType = 3 Then Call English Module Else If CurrencyType = 4 Then Call Japanese Module Else If CurrencyType = 5 Then Call French Module Else If CurrencyType = 6 Then Call Exit Module End Currency Type Module Canadian Module Declare CurrencyAmount as real Declare USDollar as real Nationality = ³Canadian Dollars´ Display.

000 Then Display ³Invalid Amount´ Call Canadian Module Else USDollar = CurrencyAmount * .Mexican Module Declare CurrencyAmount as real Declare USDollar as real Nationality = ³Mexican Pesos´ Display.8085 Call Output Module End English Module Japanese Module Declare CurrencyAmount as real Declare USDollar as real Nationality = ³Japanese Yen´ Display. ³Please Enter Amount of Currency (0-100.000 Then Display ³Invalid Amount´ Call Canadian Module Else USDollar = CurrencyAmount * 104.000 Then Display ³Invalid Amount´ Call Canadian Module Else USDollar = CurrencyAmount * 9.000)´ Input CurrencyAmount If CurrencyAmount < 0 or CurrencyAmount > 100.000)´ Input CurrencyAmount If CurrencyAmount < 0 or CurrencyAmount > 100.5085 Call Output Module End Mexican Module English Module Declare CurrencyAmount as real Declare USDollar as real Nationality = ³English Pounds´ Display. ³Please Enter Amount of Currency (0-100.000)´ Input CurrencyAmount If CurrencyAmount < 0 or CurrencyAmount > 100.9200 Call Output Module End Japanese Module . ³Please Enter Amount of Currency (0-100.

Dollars Display ³Press any key to return to Main Menu´ Pause Call Input Module End Output Module .´ ´.2561 Call Output Module End French Module Exit Module Declare QuitProg as string Display ³Are you sure you want to Quit? Y/N´ Input QuitProg If QuitProg = ³Y´ or ³y´ Then Call Input Module Else If QuitProg = ³N´ or ³n´ Then End Else Display ³Invalid entry.S.French Module Declare CurrencyAmount as real Declare USDollar as real Nationality = ³French francs´ Display.000 Then Display ³Invalid Amount´ Call Canadian Module Else USDollar = CurrencyAmount * 6.´ is ³.000)´ Input CurrencyAmount If CurrencyAmount < 0 or CurrencyAmount > 100.CurrencyAmount.USDollar´ U. ³Please Enter Amount of Currency (0-100.Nationality. please try again´ Call Exit Module End Exit Module Output Module Declare CurrencyAmount as real Declare Nationality as string Declare USDollar as real Display ³The value of ³.

52 .0 Expected Output: USDollar = 68. Please try again Test Case 3: Inputs: CurrencyType = ³9´ Expected Output: Invalid currency selection. Please try again ------------End Menu Error Testing------------ ----------Currency Conversion Testing---------Test Case 1: Valid International Currency = Canadian Inputs: CurrencyType = 1 CurrencyAmount = 100.12 Test Case 2: Valid International Currency = Mexican Inputs: CurrencyType = 2 CurrencyAmount = 100.Currency Conversion Test Procedures **********Begin Test Procedure*********** ------------Menu Error Testing-----------Test Case 1: Inputs: CurrencyType = ³U´ Expected Output: Invalid currency selection.0 Expected Output: USDollar = 10. Please try again Test Case 2: Inputs: CurrencyType = ³0´ Expected Output: Invalid currency selection.

0 Expected Output: USDollar = 15.Test Case 3: Valid International Currency = English Inputs: CurrencyType = 3 CurrencyAmount = 100.0 Expected Output: USDollar = 00.0 Expected Output: USDollar = 164.95 Test Case 5: Valid International Currency = French Inputs: CurrencyType = 5 CurrencyAmount = 100.33 Test Case 4: Valid International Currency = Japanese Inputs: CurrencyType = 4 CurrencyAmount = 100.98 Test Case 6: Valid International Currency = Quit Inputs: CurrencyType = 6 Expected Output: End program ----------End Currency Conversion Testing---------- ----------Conversion Error Testing---------Test Case 1: Valid International Currency = Canadian Inputs: CurrencyType = 1 CurrencyAmount = 0 Expected Output: Invalid Amount Test Case 2: Valid International Currency = Mexican Inputs: CurrencyType = 2 CurrencyAmount = 50000000 Expected Output: Invalid Amount .

0 Expected Output: The value of 100 Canadian Dollars is 68.Test Case 3: Valid International Currency = English Inputs: CurrencyType = 2299938847 CurrencyAmount = 100.52 U.0 Expected Output: Invalid Amount ----------End Conversion Error Testing---------- ----------Output Testing---------Test Case 1: Valid International Currency = Canadian Inputs: CurrencyType = 1 CurrencyAmount = 100.S Dollars Test Case 2: Valid International Currency = Mexican Inputs: CurrencyType = 2 CurrencyAmount = 100.0 Expected Output: The value of 100 Mexican Pesos is 10.S Dollars .12 U.0 Expected Output: Invalid Amount Test Case 4: Valid International Currency = Japanese Inputs: CurrencyType = 9 CurrencyAmount = 0 Expected Output: Invalid Amount Test Case 5: Valid International Currency = French Inputs: CurrencyType = 99000000 CurrencyAmount = 100.

0 Expected Output: The value of 100 French Francs is 15.33 U.S Dollars Test Case 4: Valid International Currency = Japanese Inputs: CurrencyType = 4 CurrencyAmount = 100.S Dollars Test Case 6: Valid International Currency = Quit Inputs: CurrencyType = 6 Expected Output: Are you sure you want to Quit? Y/N ----------End Output Testing---------- **********End of Test Procedure********** .0 Expected Output: The value of 100 English Pounds is 164.98 U.S Dollars Test Case 5: Valid International Currency = French Inputs: CurrencyType = 5 CurrencyAmount = 100.Test Case 3: Valid International Currency = English Inputs: CurrencyType = 3 CurrencyAmount = 100.95 U.0 Expected Output: The value of 100 Japanese Yen is 00.