Create an inheritance hierarchy that a bank might use


Asasignment: Fundamentals Of Programming C++

C++ Programming.

Create an inheritance hierarchy that a bank might use to represent customers' bank accounts. All customers at this bank can deposit (i.e., credit) money into their accounts and withdraw (i.e., debit) money from their accounts. More specific types of accounts also exist. Savings accounts, for instance, earn interest on the money they hold. Checking accounts, on the other hand, charge a fee per transaction (i.e., credit or debit).

A. Create a base class Account. Base class Account should include

· One data member of type double to represent the account balance.

· A constructor that receives an initial balance and uses it to initialize the data member. The constructor should validate the initial balance to ensure that it is greater than or equal to 0.0. If not, the balance should be set to 0.0 and the constructor should display an error message, indicating that the initial balance was invalid.

· Member function Credit should add an amount to the current balance.

· Member function Debit should withdraw money from the Account and ensure that the debit amount does not exceed the Account's 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.

A. Derived class SavingsAccount should inherit the functionality of an Account, but also include

· One data member of type double indicating the interest rate (percentage) assigned to the Account.

· A constructor that receives the initial balance, as well as an initial value for the interest rate.

· Member function calculateInterest that returns a double 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.

A. Derived class CheckingAccount should inherit from base class Account and also include

· One data member of type double that represents the fee charged per transaction.

· A constructor that receives the initial balance, as well as a parameter indicating a fee amount.

· Class CheckingAccount should redefine member functions credit and debit so that they subtract the fee from the account balance whenever either transaction is performed successfully. CheckingAccount's versions of these functions should invoke the base-class Account version to perform the updates to an account balance. CheckingAccount's debit function should charge a fee only if money is actually withdrawn (i.e., the debit amount does not exceed the account balance).

Format your assignment according to the following formatting requirements:

1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also include a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

3. Also Include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create an inheritance hierarchy that a bank might use
Reference No:- TGS02957422

Now Priced at $50 (50% Discount)

Recommended (90%)

Rated (4.3/5)