CS 1711 Lab 7 - November 23 and 25, 1999
File Streams

In this exercise we are going to implement a monthly cheque-book writing program. The program input is a sequence of transaction records on the file trans.dat. The output is to be written to the file cheque.out to be stored in your Lab6 folder. An outline of the program is in cheque.cpp. You will also complete implementation of the required classes, Account and Transaction which are outlined in account.h and transaction.h. The first line of the data file is an integer code for the month, a number of tranactions and an initial balance, for example 11 7 510.77 means the month is November and there are 7 transactions from an initial balance of $510.77. Each line following consists of a `D' or `C' (for debit or credit), an integer (for the date), and a real value (for the amount). The file cheque.out should look like (in part, for example):

October 
Date Type Amount Balance
1                $510.77
3     C   25.00   535.77
6     D   100.00  435.77
...  ...   ...     ...
Final balance    $455.44

where the last line simply gives the final monthly balance.

The steps are as follows:

  1. Obtain the file trans.dat, store it in your Lab7 folder.
  2. Obtain the outline file cheque.cpp.
  3. Carefully read the function prototypes.
  4. Add any necessary file directives.
  5. Obtain the outline files for the classes.
  6. Complete the implementation of the classes.
  7. Complete the main program and its functions.
  8. Save your program as cheque.cpp.

End of Lab

Demonstrate your driver program and your finished program (you should begin by showing the instructor your Lab7 folder without a cheque.out file, then run the program...)