Homework: Classes

  1. Write the definition for a checking account class which has data members for the following: and the following member functions:
    1. open a checking account, specifying the account number and initial balance
    2. write a check for the specified amount
    3. deposit the specified amount into the checking account
    4. display the account number and current balance
  2. Write the implementation for the member functions of the checking account class.
  3. Write client code to use the checking account class
    1. declare two checking account objects
    2. for the first account, open the account with account number 2345 and initial balance $1500, write two checks for $835 and $284, deposit $1450, and display the account
    3. for the second account, open the account with account number 9876 and initial balance $4200, deposit $720, write a check for $2279, and display the account
  4. For the checking account class, replace the open function with two constructors. The default constructor initializes the account number to 1111 and the balance to zero. The other initializes the account number and balance to the values given as parms.
  5. Add an array of 5 checking account objects to the client code. Rewrite the code for question two so that it uses the first two objects in the array.

Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2006