Assignment 7: CheckBook Program

Write a program that you can use to maintain your checkbook. It should implement at least the following choices:

Enter a new deposit
Enter a new check
Delete a record
Find a record
Display account summary
Display all records
Save the Checkbook (implemented later)
Retrieve the Checkbook (implemented later)

You might want to make use of the following data structures:

CONST
    MaxNChecks = 150;

TYPE
   DateType = RECORD
                    day  : INTEGER;
                    month: INTEGER;
                    year : INTEGER;
              END;
    CheckType = RECORD
                      ID     : INTEGER;
                      Date   : DateType;
                      Payee  : STRING;
                      Amount : REAL;
                END;
    CheckBookType = RECORD
                          data          : Array[1..MaxNChecks] of CheckType;
                          last          : INTEGER;
                          current       : INTEGER;
                          NumChecks     : INTEGER;
                          NumDeposits   : INTEGER;
                          CheckAmount   : REAL;
                          DepositAmount : REAL;
                    END;

To enter a deposit, you can simply enter a check with a negative amount, and enter 'DEPOSIT' as payee.

Your program should use a menu similar to the above. The global variables should be 'gCheckBook' of type CheckBookType and 'UserInput' to contain the menu choice the user makes.

IMPORTANT NOTES

Write procedures to read and write the new types Date and Check first. Test those procedures to make sure they work properly.
Write the basic menu program, which procedures to handle each menu item. In other words, you need procedures such as 'HandleItem1', 'HandleItem2', etc. All of these procedures should take one variable parameter of type CheckBookType. For now, the only code in each procedure should be to write a line indicating what the procedure will accomplish once it is finished. Test the menu program to make sure it works properly.
Write a procedure to initialize all fields in the variable of type CheckBookType. In other words, Last, NumDeposits, NumChecks, etc. should all be set to zero initially. Make sure you use a variable parameter for this procedure.
When entering a deposit, first display instructions like 'enter a negative number for the amount, and DEPOSIT for payee'. Then call the procedure to read a check. In addition, this procedure should increase the variable NumDeposits by one, and the variable DepositAmount by the correct amount.
To enter a check, simply call the procedure ReadCheck with the correct parameter. Also, this procedure should increase the variable NumChecks by one, and the variable CheckAmount by the correct amount.
The 'Delete' procedure is going to be the hardest one by far. It will have to delete the appropriate check by moving all other entries in the CheckBook.Data array, if necessary. Also, it has to adjust the variables NumChecks, NumDeposits, DepositAmount, CheckAmount in the correct way. You might want to wait with this procedure until after class.
The account summary should display the number of checks and deposits made, the total amount of checks and deposits made, and the current balance in your account.
To display all checks, use a loop that runs from 1 to 'CheckBook.Last' and use the procedure WriteCheck each time.

Good luck, have a happy Thanksgiving, and post any questions that you have right away !!!

Bert Wachsmuth