CIS 16, Pr. Cogan

Assignment #17

Due Date:

 

            A bank keeps the data about its accounts in a file.  It keeps each day’s transactions in another file.  At midnight it reads the transactions and writes the accounts file out again.  Write a program to model this behavior.

 

            When a depositor tries to make a deposit, the program checks if he has an account, if so it “deposits” the money.  If not it “opens an account” and then deposits the money.

           

            When he tries to withdraw money, it checks if he has an account and if there is enough money in the account.

           

            When a new account is opened, it is assigned the next consecutive account number.  The highest number used so for is stored in the first line of the account file.

           

            Before writing the account file, the bank prints out the info in all its accounts in a neat chart with headings.  It does not print the highest number account so far.  (Think: will Vector’s toString() simplify or complicate printing the chart and reading the account file?)  Use static read method and appropriate toString method.

 

            Depositor may request a report on his account.  He may supply either his name or his account number (What kind of methods do you need here?)

 

            Run your program for day1 and day2.  Use a Command Line Argument to supply the name of the Transaction file.  (Make sure the person running the program has supplied the argument)

 

DAY1: (file1)                          DAY2: (file 2)

            Harry 10                                  Harry -6

            Barry 10                                  Barry -10

            Harry 5                                    Larry 5

            Barry –3                                  Larry 10

            Harry 5                                    report 2

            report Harry