buySell pseudo code document
buySell Pseudo Code Document
Program Header:
Currency Trader Simulation
Author: Joe College
Purpose: Buy and Sell currency simulation using real-time exchange rates from the Internet.
End Program Header.
Start Program:
Include stdio.h
Include ctype.h
Main()
Variables:
Float amount, curr1=1.0, curr2, Buy, Sell, balance, percent
Char currName[20], currSym[3], Valid
Print “Currency Trader”
Print “Enter the Name of currency you are buying (No Spaces): ”
Input currency assign to currName
Print “Enter the 3 letter symbol of currency you are buying: “
Input symbol assign to currSym
Valid = F
While valid not T
Print “Enter the currency exchange rate for (currSym value) found at www.dailyfx.com: “
If input exchange rate assign to curr2 not a number
Print “Input of invalid characters: Please enter a number: “
Valid = F
Else if curr2 <= 0.0
Print “Input of negative numbers: Please enter a number: “
Valid = F
Else Valid = T
Valid = F
While valid not T
Print “Enter the amount of USD to buy the currName”
amount = 0.0
If input amount assign to amount not a number
Print “Input of invalid characters: Please enter a number: “
Valid = F
Else if amount <= 0.0
Print “Input of negative numbers: Please enter a number: “
Valid = F
Else
Print “$amount.2 USD = $Buy.2 currSym (currName)”,
(Buy=amount*curr1/curr2)
Valid = T
Valid = F
While valid not T
Print “Sell the currency, exchange it back to USD”
Print “Enter the new currency exchange rate for currSym found at www.dailyfx.com: “
If input exchange rate assign to curr2 not a number
Print “Input of invalid characters: Please enter a number: “
Valid = F
Else if curr2 <= 0.0
Print “Input of negative numbers: Please enter a number: “
Valid = F
Else Valid = T
Print “Select any key to Sell the $Buy.2 currName
Getch() to pause for any key
Print “$Buy.2 currSym (currName) = $Sell.2 USD” , (Sell=Buy*curr2/curr1)
Steve Clayden, Gateway Community College © 2005 1 of 2