Homework: Classes
- Write the definition for a checking account class which has
data members for the following:
- account number (an int)
- balance (a float)
and the following member functions:
- open a checking account, specifying
the account number and initial balance
- write a check for the specified amount
- deposit the specified amount into the checking account
- display the account number and current balance
- Write the implementation for the member functions of the
checking account class.
- Write client code to use the checking account class
- declare two checking account objects
- 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
- 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
- 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.
- 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