It210 Week 4 Psuedocode

Only available on StudyMode
  • Download(s) : 38
  • Published : March 16, 2013
Open Document
Text Preview
Program Pseudocode
Currency_Convertor Main Module
Delcare USDollars As Float

Declare Rate1 As Float
Declare Rate2 As Float
Declare Rate3 As Float
Declare Rate4 As Float
Declare Rate5 As Float

Declare Candian_Dollars As Float
Declare Mexican_Pesos As Float
Declare English_Pounds As Float
Declare Japanese_Yen As Float
Declare French_Francs As Float

Declare Display_Selection As Int
Declare Currency_Type As String
Declare Display_Selection As Int
Declare GIV as Float
Declare DRInput As String
Declare aa As String

Set Rate1 = 1.4680
Set Rate2 = 9.5085
Set Rate3 = 1.6433
Set Rate4 = 104.9200
Set Rate5 = 6.2561

Call Display_Menu Module
Call Get_Int_Value Module
Call Convert_Currency Module
Call Display_Results Module
End Currency_Convertor Main Module

Quit_Program Module
Set QuitNow As String
Write: “Are you sure you would like to exit this program?”
Write: “Enter Yes or No.”
Input QuitNow
While QuitNow != Yes || yes|| No || no
Write: “That is not a correct entry!”
Write: “Please enter Yes or No.”
Input QuitNow
End While
If
QuitNow = Yes || yes Then
End Display_Menu Module
End Get_Int_Value Module
End Convert_Currency Module
End Display_Results Module
End Currency_Convertor Module
Else
QuitNow = No || no Then
Write: “Let’s start then.”
Call Display_Menu
End If
End Quit_Program

Display_Menu Module
Write: “*Welcome to the Currency Convertor*”
Write: “Please select the currency you would like to convert to U.S. Dollars.” Write: “Enter 1 to convert Canadian dollars to U.S. Dollars.” Write: “Enter 2 to convert Mexican Pesos to U.S. Dollars.” Write: “Enter 3 to convert English Pounds to U.S. Dollars.” Write: “Enter 4 to convert Japanese Yen to U.S. Dollars.” Write: “Enter 5 to convert French Francs to U.S. Dollars.” Write: “Enter 6 if you would like to Quit now.”

Input Display_Selection
While Display_Selection != 1 || 2|| 3 || 4 || 5 || 6
Write: “That is an invalid selection!”
Write: “Please enter a correct value.”
Input Display_Selection
End While

If Display_Selection = 1 || 2 || 3 || 4 || 5 Then
Write: “Would you like to continue?”
Write: “Enter Yes or No.”
Input aa
If aa = “Yes” || “yes” Then
Call Get_Int_Value
Else aa = “No” || “no” Then
End Display_Menu
Call Quit_Program
End If
Else if
Display_Selection = 6 Then
Call Quit_Program
End Display_Menu
End If
End Display_Menu Module

Get_Int_Value Module
Write: “How much currency would you like to convert today?” Input GIV
While GIV = String || 0
If GIV = String Then
Write: “The value has to be greater than 0.”
Write: “Please enter a value greater than 0.”
Input GIV
Else If GIV = 0 Then
Write: “The value has to be greater than 0.”
Write: “Please enter a value greater than 0.”
Input GIV
End If
End While
If GIV = Float Then
Call Convert_Currency Module
End If
End Get_Int_Value Module

Convert_Currency Module
If
Display_Selection = 1 Then
Set Currency_Type = “Canadian dollars”
USDollars = GIV / Rate1
Call Display_Results Module
Else if
Display_Selection = 2 Then
Set Currency_Type = “Mexican pesos”
USDollars = GIV / Rate2
Call Display_Results Module
Else if
Display_Selection = 3 Then
Set Currency_Type = “English pounds”
USDollars = GIV * Rate3
Call Display_Results Module
Else if
Display_Selection = 4 Then
Set Currency_Type = “Japanese yen”
USDollars = GIV / Rate4
Call Display_Results Module
Else
Display_Selection = 5 Then
Set Currency_Type = “French francs”
USDollars = GIV / Rate5
Call Display_Results Module
End If
End Convert_Currency Module

Display_Results Module
Write: GIV & Currency_Type & “ is “ & USDollars & “ in U.S. Dollars.” Write: “Would you like do another conversion?”
Write: “Please enter Yes or No.”
Input DRInput
While DRInput != Yes || yes ||No || no
Write: “That is not a valid entry!”
Input DRInput
End While
If
DRInput = Yes || yes Then
Call...
tracking img