Design a generic class tohold the following information about a bank account: Ba
ID: 3615035 • Letter: D
Question
Design a generic class tohold the following information about a bank account: Balance,Number of deposits this month, Number of withdrawals, Annualinterest rate, Monthly service charges. The class should havethe following member functions: The class should have thefollowing member functions:constructor: Accepts arguments for the balance and annual interestrate.
deposit: A function that accepts an argument for the amount of thedeposit. The function should add the argument to the accountbalance. It should also increment the variable holding the numberof deposits.
withdraw: A function that accepts an argument for the amount of thewithdrawal. The function should subtract the argument from thebalance. It should also increment the variable holding the numberof withdrawals.
calcInt: A function that updates the balance by calculating themonthly interest earned by the account, and adding this interest tothe balance. This is performed by the following formulas:
Monthly Interest Rate = (Annual Interest Rate /12)
Monthly Interest = Balance * Monthly Interest Rate
Balance = Balance + Monthly Interest
monthlyProc: A function that subtracts the monthly service chargesfrom the balance, calls the calcInt function, and then sets thevariables that hold the number of withdrawals, number of deposits,and monthly service charges to zero.
Next, design a savings account class, derived from the genericaccount class. The savings account class should have the followingadditional member:
status (to represent an active or inactive account)
If the balance of a savings account falls below $25, it becomesinactive. The status member could be a flag variable. No morewithdrawals may be made until the balance is raised above $25, atwhich time the account becomes active again. The savings accountclass should have the following member functions:
withdraw: a function that checks to see if the account is inactivebefore a withdrawal is made. (No withdrawal will be allowed if theaccount is not active). A withdrawal is then made by calling thebase class version of the function.
deposit: a function that checks to see if the account is inactivebefore a deposit is made. If the account is inactive and thedeposit brings the balance above $25, the account becomes activeagain. The deposit is then made by calling the base class versionof the function.
monthlyProc: before the base class function is called, thisfunction checks the number of withdrawals. If the number ofwithdrawals for the month is more than 4, a service charge of $1for each withdrawal above 4 is added to the base class variablethat holds the monthly service charges. (Don’t forget tocheck the account balance after the service charge is taken. If thebalance falls below $25, the account becomes inactive).
The program should display statistics of the month, includingbeginning balance, total amount of deposits, total amount ofwithdrawals, service charges, and ending balance.
Explanation / Answer
x.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.