Question: Develop a banking program using an Account class. Create SavingsAccount and CheckingAccount objects. For each account, the user to use an amount of money to

Develop a banking program using an Account class. Create SavingsAccount and CheckingAccount objects. For each account, the user to use an amount of money to withdraw from the account using member function, debit, and an amount of money to deposit into the account using member function, credit. As you process each account, determine its type. If an Account is a SavingsAccount, calculate the amount of interest owed to the account using member function, calculateInterest, then add the interest to the account balance using member function, credit. After processing an account, print the updated account balance obtained by invoking base-class member function, getBalance. If an Account is a CheckingAccount, calculate the fees (2%) charged per transaction.

The Account Inheritance Hierarchy is as follows:

Create a base class Account and derived classes, SavingsAccount and CheckingAccount that inherit from class Account. Base class Account should include one data member of type double to represent the account balance. The class should provide at least three member functions:

Member function, credit, should add an amount to the current balance.

Member function, debit, should withdraw money from the account and ensure the debit amount does not exceed the accounts balance. If it does, the balance should be left unchanged and the function should print the message Debit amount exceeded account balance.

Member function, getBalance, should return the current balance.

The SavingsAccount should have a data member of type double indicating the interest rate assigned to the account. It also includes a member function, calculateInterest, that returns a double indicating the amount of interest earned by an account, by multiplying the interest rate by the account balance.

The CheckingAccount should have a data member of type constant double indicating the fee charged per transaction. Every time there is a debit or a credit, it should subtract the fee from the account balance. CheckingAccounts debit function should charge a fee only if money is actually withdrawn (i.e., the debit amount does not exceed the account balance.)

Use constructors to initialize the data members and make sure the initial balance is greater than or equal to zero.

Write a program to test your classes designed above by using the following numbers and transactions:

Checking Starting Balance 500.00
Savings Starting Balance 1000.00
Withdraw from Checking 230.00
Withdraw from Savings 100.85
Deposit into Checking 400.25
Deposit into Checking 250.00
Deposit into Savings 500.00
Withdraw from Checking 2000.00
Withdraw from Savings 1000.00
Withdraw from Savings 1500.00
Deposit into Savings

-500.00

(Yes, the last deposit into savings is a negative amount).

Make sure you display the balance after each transaction.

If there is an error, make sure you state the error and what caused it.

Turn in your code and your output file with the transactions above showing deposits and withdraws including all error messages.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!