IUP Computer Science
  Due 8 May
CO 110  Spring 1989

   Programming Project #6
  Due 8 May


    The file 110ACCOUNTS.COMPSCI has checking account information for each account holder at the CO 110 Bank.  A record in this file has this form.

    Columns        What it contains
     1 - 35        Name of the account holder
    36 - 40        Account number
    41 - 48        Final balance for the previous month in the
                    form xxxxx.xx
    51 - 59        Tax identification number
       60          Code for bank branch

The records in this file are in account number order (ascending).   The last record in the file is a sentinel with 99999 in the account number field.

    The file 110EVENTS.COMPSCI has all the transactions that relate to all accounts for a given month.  A record in this file has this form.

    Columns        What it contains
     1 - 2         Transaction code:  DP for deposit, CK for
                    check, NW for new account, and CL for close
                    account.
     3 - 7         Account number
     8 - 15        Amount of a check, a deposit, the starting
                    amount for a new account, or the amount paid
                    out on closing an account.
    16 - 23        Date in the form yy/mm/dd
       24          Bank branch code (only for NW)
    25 - 58        Name (only for NW)
    60 - 68        Tax identification number (only for NW)

The transactions are in account number order; if there are multiple transactions for the same account, the check and deposit transactions are in chronological order.  To keep things simple, any account that is closed will have only one transaction (a CL) and any new account will have only one transaction (a NW)

    Read the 110EVENTS and 110ACCOUNTS files, produce a monthly bank statement for each account, and write a new accounts file that can be used next month.  The monthly statement for each account should have the form shown on the next page.  

    In a statement, the beginning balance comes from the 110ACCOUNTS.COMPSCI.  For a new account statement, NO beginning balance should be shown.  If an account is closed, NO ending balance should be shown. Accounts without a beginning or ending balance do NOT receive any interest (the interest should not be shown).  The final balance should be shown always.  

    The transactions must be listed in the order read; the actions should be one of these words/phrases:  CHECK    DEPOSIT     NEW ACCOUNT   or    CLOSE ACCOUNT.  The interest is calculated by averaging the beginning and ending balances and multiplying the average balance by .00425.  

                     CO 110 Bank Statement

name                               Account:  xxxxx
                                  Beginning balance  $xxxxx.xx
action              date                          +/-    amount
 .                   .                            .       .
 .                   .                            .       .

                                  Ending balance     $xxxxx.xx
                                  Interest           $  xxx.xx

                                  Final balance      $xxxxx.xx

    The final balance should be written as part of the record in the new accounts file, unless the person has closed the account.   The new accounts file should be called NEW-ACCOUNTS and should be written in YOUR directory.

    Hand in a batch printout that shows a compilation listing of your program, the account statements produced by your program, and a copy of the NEW-ACCOUNTS file.  The usual comments are required, as are the usual compilation options.

    Following are several sample monthly statements that might be produced based on these 110ACCOUNTS.COMPSCI records

Brown, Charlie                     10377  470.32  102583066J
McDonald, Ronald                   14905  196.81  192331908E

and these records in the 110EVENTS.COMPSCI file.

CK10377   58.6189/03/09
CK10377   15.0089/03/13
DP10377  102.5989/03/15
CK10377  117.2389/03/27
CL14905  196.8189/03/08
NW16035  400.0089/03/22EVan Pelt, Lucy                     204223448




                     CO 110 Bank Statement

Brown, Charlie                     Account:  10377
                                  Beginning balance  $  470.32
CHECK               89/03/09                       -     58.61
CHECK               89/03/13                       -     15.00
DEPOSIT             89/03/15                       +    102.59
CHECK               89/03/27                       -    117.23
                                  Ending balance     $  382.07
                                  Interest           $    1.81

                                  Final balance      $  383.88




                     CO 110 Bank Statement

McDonald, Ronald                   Account:  14905
                                  Beginning balance  $  196.81
CLOSE ACCOUNT                                      -    196.81

                                  Final balance      $     .00




                     CO 110 Bank Statement

Van Pelt, Lucy                     Account:  16035

NEW ACCOUNT                                        +    400.00
                                  Ending balance     $  400.00

                                  Final balance      $  400.00

    Based on this data, the NEW-ACCOUNTS file should have these two records in it.

Brown, Charlie                     10377  383.88  102583066J
Van Pelt, Lucy                     16035  400.00  204223448E


    On the next page is a high-level flow diagram illustrating how this program might be structured.  Many details are omitted from the flow diagram; nevertheless, it should serve as a basis for starting the program.