CS 2401 Assignment #5

Due Date: Monday, March 01, 2010, or Tuesday, March 02, 2010, depending on the day of your lab.

Objective: The goal of this assignment is to practice the use of vectors.

Motivation: A bank needs to process customers' transactions (i.e., deposits and withdraws) and to generate daily reports listing all account IDs active on that day and their corresponding balances. No two accounts have the same account ID. The system starts with no accounts.

Goal: To write a program that performs the following operations:

The file with the transaction information is available below and you should copy it to your filesystem.

Required data structure: The system should use a single vector to manage all the bank accounts. Each element of the vector should be an object of class Account with at least two private attributes (accountID and balance) and three public methods (getAccountID(), getBalance() and setBalance()).

How the system works: The system should read the transaction file provided and process one transaction a time. For each transaction, the system needs to use the accountID to identify the account in the vector and increase or decrease the balance of the account depending on whether the transaction is a deposit or a withdraw. If the current transaction is the first for a given account ID, a new account should be created and added to the vector. An account should be removed from the vector if its balance after processing the transaction becomes 0.00 (zero).

Additional information: The input file uses commas to delimit the following four values: date (YYYYMMDD), account ID (longint), operation (a char that can be either 'D' for deposit or 'W' for withdraw) and the transaction amount (a double).

You can decide the layout of the report.


20100101, 1111, D, 2000.00
20100101, 1121, D, 1000.00
20100101, 1131, D, 1000.00
20100101, 1211, D, 1000.00
20100101, 1212, D, 3030.00
20100102, 1111, D, 200.00
20100102, 1121, W, 100.00
20100102, 1222, D, 1000.00
20100102, 1222, D, 100.00
20100102, 1212, D, 330.00
20100103, 1111, W, 123.00
20100103, 1121, D, 500.00
20100103, 1131, W, 300.00
20100103, 1211, D, 321.00
20100103, 1212, W, 312.00
20100105, 1611, D, 2000.00
20100105, 1122, D, 1000.00
20100106, 1122, D, 1000.00
20100106, 1211, D, 1000.00
20100106, 1212, D, 3030.00
20100108, 1111, D, 2000.00
20100108, 1121, W, 1400.00
20100108, 1131, D, 1000.00
20100109, 1211, D, 1000.00
20100109, 1212, D, 3030.00
20100110, 1131, W, 1700.00
20100110, 1121, D, 1000.00
20100110, 1212, D, 3030.00