The customers at the bank can deposit money into their accounts and withdraw money from their
accounts. An account may be a Saving Account or a Checking Account (Hint: Create hierarchy of
Accounts).
Savings accounts earn interest on the money they hold. Checking accounts, on the other hand, charge
a fee per transaction (i.e., withdrawal or deposit).
Whenever a new account is opened, some amount must be deposited in it, so you need to take care
that initially every account must have balance greater than 0.0. If not, the balance should be set to 0.0
and the program should display an error message, indicating that the initial balance was invalid.
The operations allowed to be performed on Account are:
1. The Deposit operation adds an amount to the current balance.
2. The Withdrawal operation withdraws a money from the Account and ensures that the debit
amount does not exceed the Accounts balance. If it does, the balance should be left unchanged
and print the message “Debit amount exceeded account balance."
3. At any time, a customer must be able to know his/her current balance.
The SavingAccount is more specific type of Account in the sense that it also includes the interest rate
(percentage) assigned to the Account. A new SavingAccount should receive the initial balance, as well
as an initial value for the Savings Accounts interest rate. SavingsAccount should calculate interest
indicating the amount of interest earned by an account. Member function calculateInterest
should determine this amount by multiplying the interest rate by the account balance.
CheckingAccount is another specific type of Account that also includes the fee charged per
transaction. CheckingAccount must be initialized with some initial balance, as well as some fee
amount. For CheckingAccount redefines the operations Deposit and Withdrawal so that they subtract
the fee from the account balance whenever either transaction is performed successfully.
CheckingAccounts versions of these operations should invoke the Account version to perform the
updates to an account balance. CheckingAccounts withdrawal operation should charge a fee only if
money is actually withdrawn (i.e., the withdraw amount does not exceed the account balance).
[Hint: Model Accounts withdraw operation so that it returns a bool indicating whether money was
withdrawn. Then use the return value to determine whether a fee should be charged.]
Page 2 of 2
After careful analysis of the above description:
1. Identify classes, data members and methods.
2. Draw a diagram representing the Banking application.
3. Write a complete program that creates objects of each class and tests their member functions.
4. Add interest to the SavingsAccount object by first invoking its calculateInterest
function, then passing the returned interest amount to the object’s credit/deposit function.