Use the C programming Language to create a Currency Trading Simulation
Currency Trading is buying and selling currency for profit;
it is a major market in the world of finance. Calculating the amount of
the currency purchased is an integral part of the transaction. Exchange rates
are established to convert one currency to another, the rates change constantly
as large blocks of currency are bought and sold. The exchange rate for
a given currency may fluctuate many percentage points in a single day.
For this RWLO, you will create a C program that uses real-time exchange rates to simulate
Currency Trading using the Internet and the Miracle C or similar C program compiler.
Define the problem: The first step in program development.
Program Requirements are frequently used to help define the problem by focusing on
the results desired by the customer. In this case, our customer wants to practice Currency Trading
using a simulation to get a feel for the process prior to actually investing money in the market.
By reviewing the customer's requirements we can define the problem and create a Logic Flow Diagram of our program solution.
We can also prepare to write the program by creating a Pseudo Code document.
Using the Logic Flow Diagram
as a guide, we write all the statements of the program using regular words to represent what we need to make the simulation.
By using this technique, we can create the logic of the program line by line without worrying about correct syntax.
The Pseudo Code version can then be used as the outline for the actual program code.
Use the C programming worksheet CprogramWorksheet.doc to keep track of the program elements.
Based on the demonstration of the Currency Trading Simulation, answer the following questions:
- Buying the currency.
- Which currency was bought by the instructor in the demonstration and
what was the exchange rate from USD to that currency ? Why was this currency chosen?
- What was the resulting conversion amount in the selected currency? How was the amount determined?
What equation was used to convert the USD into the new currency?
- Selling the Currency
- Which currency was sold by the instructor in the demonstration and
what was the exchange rate from that currency to USD? Why was this currency chosen?
- What was the resulting conversion amount in USD? How was the amount determined?
What equation was used to convert the currency into USD?
- Did the transaction result in a profit or loss, based on the original investment amount
and the resulting sale back to USD? What percentage of the original investment was the profit or loss?
How was the profit or loss determined? How was the percentage determined? What equations were used?
- Logic Flow Diagrams & Pseudo Code
- Why do Logic Flow Diagrams assist in program development?
- Why does Pseudo Code assist in program development?
- Team Pseudo Code
- Follow the instructor's directions to write a Pseudo Code page.
- Program run screen capture
- Open the buySell.c program file in the Miracle C or other C compiler.
This is a partial version of the program.
- Add the analysis component to the program by writing the C code and renaming the file buySell1.c
- Run the program
- Select a currency to buy (Not USD)
- Use the realtime exchange rate data from the internet site: www.dailyfx.com
- Enter $500 as the amount to buy.
- Record the exchange rate and resulting amount on the worksheet, leave the program open on the computer.
- Wait 10 - 15 minutes and then sell back the currency by entering the realtime currency exchange rate
now showing at the dailyfx web site for the selected currency.
- Capture the screen view of the results by pressing the PrintScreen button and then pasting the view into a MSWord document and print it out.
- Enter the results on the worksheet.
- Program source code
- Print the program source code you added to buySell1.c
- Format the program output to present a professional appearance
- Use Tabs and New Lines to control the Output
Copyright © 2005
Gateway Community College
All Rights Reserved