Project Overview
Student Learning Objectives
Procedure
Content Material
Assessment
Links to Course Competencies
Supplementary Resources
Recommendations

Gateway Community College

 
Use the C programming Language to create a
Currency Trading Simulation

Procedure

Time: Approximately 120 minutes.

Materials: Computers with Miracle C or similar C compiler program, Internet access, Microsoft Word and Microsoft Notepad.

  • Student Directions
  • CprogramWorksheet.doc
  • Universal Conversion Formula
  • How to Create a Logic Flow Diagram
  • buySellFlow.doc
  • How to Create Pseudo Code
  • Pseudo Code.doc
  • CurrencyTrader.exe
  • CurrencyTrader.c
  • buySell.c
  • Notice: The RWLO site security does not allow .c or .exe file types to be uploaded. You will find the .c and .exe files renamed to _c.txt and _exe.txt. You can open them on this site however, the .exe files are binary and will display the equivelant of computer goo!
    To see the _exe.txt files work you must download them and rename back to .exe, since the .c files are text there is no need to down load them unless you want to run them in a compiler. The _c.txt files must be renamed back to .c for use in a compiler.

    Steps:
    1. Provide access to the Student Directions: Use the C programming Language to create a Currency Trading Simulation.
    2. Review the Instructions and definition of the problem with the students located at the top of the Student Directions.
       
    3. Open the Logic Flow Diagram and locate the various components of the program with the students. For example, you should identify the different operations: Buying the currency -- Printing the result to the screen, Input of currency selections - currency name and exchange rate from the internet, error check inputs, input amount to buy ($500), error check input, conversion, output the result. Explain the conversion process using the Universal Conversion Formula.

      Instructor demonstrates the program CurrencyTrader.exe using currency selections suggested by the students, entering $500 as the amount, shows the resulting conversion in the selected currency. Students should then respond to the two questions (Questions 1 and 2 of Part A: 1. Currency bought & exchange rate.
      2. Resulting amount of the currency conversion.)


      Continue reviewing the Logic Flow Diagram: Selling the Currency -- Printing the prompt for selling exchange rate, error checking input, converting the bought currency back to USD, printing the result of the conversion, calculating profit or loss, calculating the percentage of profit or loss.

      Instructor demonstrates the second half of the program using the new exchange rate from the internet.
      (at least 10 minutes older than the first rate)
      Students respond to the questons about the sale (Questions 1 - 3 of Part B: 1. Currency sold & exchange rate.
      2. Profit or Loss amount. 3. Profit or loss percentage.)

       
    4. Instruct the students how to make a Logic Flow Diagram using Microsoft Word. How to Create a Logic Flow Diagram.
      • Ask the students to open and/or distribute the step-by-step instructions on how to create Logic Flow Diagram using Microsoft Word.
        • Instruct the students to open and/or distribute the buySellFlow.doc logic Flow Diagram. Ask them to add the transaction analysis steps to the Logic Flow Diagram in preparation for the final individual assignment.
           
        • If necessary, lead the students through the first few steps until they feel comfortable following the instructions.

       
    5. Explain to the students the purpose of Pseudo Code; how it helps organize code writing and how it is derived from the Logic Flow Diagram.

    6.  
    7. Once completed, students should respond to the four questions relating to Logic Flow Diagrams and Pseudo Code (Questions 1 - 4 of Part C: How do Logic Flow Diagrams and Pseudo Code help organize program development?).
       
    8. In class lab (or homework) (30 min.): Assign the students to one of three teams to complete the following tasks -
      • Team 1: Write the pseudo code for the Buy portion of the program.
      • Team 2: Write the pseudo code for the Sell portion of the program.
      • Team 3: Write the pseudo code for the Analysis portion of the program.

      • Prior to splitting up into the work teams, have a design meeting with the class to discuss the names of the variables to be used in each part of the program.

       
    9. After 30 minutes, have the teams present the results of their efforts to the class.
      • The important points will be the menu, variable assignments, conversion equations and results analysis.
      • Come to consensus on a workable solution for the analysis phase.
      • Post the analysis pseudo code for all the students to use as a reference for the next activity.

    10.  
    11. Distribute or have the students open the buySell.c program file in the Miracle C or other C compiler. This is a partial version of the program. Ask the students to perform the following:
      • Add the analysis component to the program by writing the C code and renaming the file buySell1.c.
      • Run the program by selecting a currency other than USD entering $500 and using the realtime exchange rate data from the internet site: www.dailyfx.com.
      • Have the students record the exchange rate and resulting amount on the worksheet, leaving the program open on their computer.
      • Instruct the students to wait 10 - 15 minutes and then sell back the currency by entering the realtime currency exchange rate for now showing at the dailyfx web site converting the selected currency back into USD.
      • The results of entering the new exchange rate will be an analysis of the sale. Ask the students to 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.
      • Have the students enter the results on the worksheet.


      • Students turn in the:
        • screen capture printout.
        • worksheet.
        • completed program file buySell1.c.


    Copyright 2005 Gateway Community College
    All Rights Reserved