Computer Science 122
Assignment 4
Due: February 26, 2002

Modify your third program so that it reads in both checks and deposits.  Store the checks in a Check class and the deposits in a Deposit class.  Both should extend a Transaction class that is their common super class.

Manage the transactions with a List class.  It should read in the data and display it on the screen.  It should also keep track of the balance.  After each check is displayed, show what the current balance is in the account.  Start the balance off at 0.  Then add new deposits and subtract checks.

Follow the example that displayed Figures.  The Transaction class will be similar to the Figure class, and the Check and Deposit classes to the Circle and Square classes.  Use the same names for reading and displaying transactions in all three classes.  This way the List class only has to use the one name, not three different ones.

You should have a getType method in the Transaction class in order to know whether you have a check or a deposit.  This can be used when you are calculating the new balance.  Otherwise you won’t know whether to add or subtract the new amount.

Make sure you have a comment describing each class and method explaining what it does.

You can use the following sample data or make up your own.

Deposit
01/15/2002
XYZ Company
350.15
Check
01/31/2002
101
Keyspan
35.66
Deposit
01/31/2002
Alice Lee
150.00
Check
02/04/2002
102
ConEdison
35.12
Check
02/04/2002
103
Red Cross
75.00
Check
02/05/2002
104
MasterCard
120.58
Check
02/05/2002
105
Waldbaums
56.95
Check
02/08/2002
106
Gap
136.98
Deposit
02/15/2002
XYZ Company
350.15