Question: In C++ Write a program that contains a BankAccount class. The BankAccount class should store the following attributes: account name account balance Make sure you
In C++
Write a program that contains a BankAccount class.
The BankAccount class should store the following attributes:
account name
account balance
Make sure you use the correct access modifiers for the variables.
Write get/set methods for all attributes.
Write a constructor that takes two parameters.
Write a default constructor.
Write a method called Deposit(double) that adds the passed in amount to the balance.
Write a method called Withdraw(double) that subtracts the passed in amount from the balance. Do not allow a balance < 0.
Write a method called Printit() that prints all of the attribute values.
Inside of main() create one instance of the BankAccount class. Make sure you call Deposit and Withdraw. Finally, print out the values on the instance you created.
Derive a new class called SavingsAccount from the BankAccount class.(Savings inherits from BankAccount)
SavingsAccount should store the following new attribute: interest.
Write get/set methods for all attributes.
Write a constructor that takes three parameters. Make sure to call the base class constructor.
Write a default constructor.
Write a method called ApplyInterest() that will apply the interest amount to the balance.
Inside of main() create one instance of the SavingsAccount class. Make sure you call Deposit, Withdraw, ApplyInterest. Finally, print out the values on the instance you created.
Derive a new class - Customer Class (Inherits from Savings savings inherits from bank account)
Write a customer class. Customer Class has the following new attribute
Customer Name
Write get/set methods for the Name attribute.
Create WithdrawSavings and DepositSavings methods. These methods should call methods on the Savings account and the Bank account members.
Create an instance of the Customer class in main. Make sure you set values on that instance. Print the values of the Customer on standard output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
