COSC 071: Computer Science I

Project 2
Spring 2000

Due: Feb 23th @ 5 P.M.
5 points

FastResponse Bank has hired you---yes, you---to write a program to process a collection of checking account transactions (deposits and withdrawals) for customer checking accounts. Your program should begin by reading in the beginning account balance, processing each transaction to compute the new balance, and producing a monthly bank statement, given the conditions and constraints presented below.

The transactions and their respective codes are as follows:

BEG Beginning balance
CHK Check transaction
ATM Withdrawal from ATM
DEP Deposit

If at any time after a withdrawal, the account shows a negative balance, your program should stop processing any subsequent withdrawals, print an error message to indicate an overdrawn account. Each overdrawn check incurs a $25 charge. The account balance should not be altered by subsequent withdrawals that are not covered. The program should discard any invalid transaction records (e.g., invalid transaction codes) and print an error message indicating that the transaction has been discarded and what caused the error. Only one beginning balance transaction should appear in the file. Each ATM transaction carries with it a 75 cent service charge. Furthermore, when a customer's balance falls below a minimum balance of $500, each check transaction carries with it a 25 cent service charge. However, the customer does earn 5% of the ending account balance for the portion of the balance that exceeds the minimum balance. The accumulated service charge, as well as any interest earned, should be assessed at the end of the transaction period, which you can assume to be the 30th day of the month.

The values needed for the program should come from a data file named proj2.dta. The file format is as follows: the first field of each transaction record represents the day of the month the transaction occurred, the second field is a code for the nature of transaction, and the third is the amount of the transaction. For example, the data file:

1  BEG 350.25
2  CHK 250
15 DEP 550.50
indicates that a customer started with a beginning balance of $350.25, had a check transaction for the amount of $250 on the 2nd day of the month, and deposited $550.50 on the 15th of the month.

Given this sample data file, your output should appear in 6 columns as shown:

Date  T#         Description     Deposit  Withdrawal     Balance
   1   1   Beginning Balance                              350.25
   2   2               Check                  250.00      100.25
  15   3             Deposit      550.50                  650.75
  30         Interest Earned        7.54                  658.29
  30          Service Charge                    0.25      658.04
  30          Ending Balance                              658.04

And finally, you should create an output file named proj2.out and write the information needed for next month's processing. Construct your own data sets to test the various features of your program. I'll post the real data set on the Tuesday morning (2/22) before the project is due.

Instructions for Electronic Submission: At the top of the file containing your source code (i.e., the file containing the C++ instructions), place the following header comment, with the appropriate modifications:

//
// Project 2
// Name: <your name>
// SID: <last four digits of student ID>
// E-mail: <e-mail address>
// Instructor: Maloof
// TA: <TA's name>
// COSC 071-<section number>
//
// Description: <Describe your program>
//

All programs must run under UNIX and must compile using GNU g++. When you are ready to submit your program for grading, e-mail it to your TA using the last four digits of your student ID and the suffix ``.cc'' as the subject line.

For example, if the last four digits of your student ID is 1234, the name of your source file is proj2.cc, and your TA's e-mail address is ``imagoodta@georgetown.edu'', then you would type at the UNIX prompt:

gusun% mailx -s "1234.cc" imagoodta@georgetown.edu < proj2.cc
You are executing the mailx command. The -s option indicates that the string "1234.cc" is the subject heading. imgagoodta@georgetown.edu is the address to which the mail will be sent. The part ``< proj2.cc'' takes your source file and directs it into the mailx command.

You can also use pine to submit your project. After filling in the To and Subject fields, type the ^R command in the MESSAGE TEXT screen. Pine will ask for a file name, which it will then load as your message text. Type ^X to send the e-mail.

You must submit your project by e-mail before 5:00 P.M. on the due date. Late projects will be subject to a penalty.

If you need to include a message to you TA about your submission, then type the message as a comment in the program.

Once you've submitted your project, it is important to keep an electronic copy on a university machine (e.g., gusun or cssun) that preserves the modification date and time. If we lose your project or the e-mail system breaks, then we will need to look at the modification date and time of your project to ensure that you submitted it before it was due.