Question
bankAccount polymorphism bankAccount - The bankAccount class will be abstract in this assignment and will use virtual and pure virtual functions. Data: accountNumber name balance
bankAccount polymorphism
bankAccount - The bankAccount class will be abstract in this assignment and will use virtual and pure virtual functions.
Data:
accountNumber
name
balance
Methods:
getAccountNumber
getBalance
getName
setName
deposit
withdraw (virtual)
print (virtual)
createMonthlyStatement (pure virtual)
Constructor:
sets account number
set account holder name
sets account balance
Checking Account
Data:
interestRate
minimumBalance
serviceCharge
fee
Methods:
getMinimumBalance
setMinimumBalance
getInterestRate
setInterestRate
getServiceCharge
setServiceCharge
postInterest
writeCheck
withdraw
createMonthlyStatement
Constructor:
sets account holder name
sets account number
sets account balance
sets minimum balance
set interest rate
Notes:
postInterest takes the interest amount based off of the total balance and adds it to the balance (balance + balance * interestRate)
writeCheck calls withdraw
withdraw checks to make sure there is enough money in the account first and reports a warning if not. If there is enough money to make the withdraw, it then checks to see if the balance will go below the minimum amount after the withdraw. If so, it checks to see if the balance will go below zero after the withdraw and the service charge is applied. Should this occur an error is reported. If not, the balance is adjust to reflect the withdraw and the service charge applied.
createMonthlyStatement this posts the interest (calls postInterest()) and deducts the monthly fee from the balance.
Print uses the base class print() and then also prints the interest rate.
savingsAccount
Data:
interestRate
Methods:
getInterestRate
setInterestRate
withdraw
postInterest
createMonthlyStatement
Constructor:
sets account holder name
sets account number
sets account balance
set interest rate
Notes:
Withdraw checks to make sure there is enough money before altering the balance. If not, a warning message is printed and the balance remains unchanged.
Create monthly statement this posts the interest to the account
Print uses the base class print() and then also prints the interest rarte.
Create a main program to test the class as follows. Use hard coded data (do not prompt the user for data, just make up values). Perform these steps in order:
define an array to hold 6 bankAccount classes.
store 3 new checking accounts and 3 new savings accounts in the array
Print a January Header
for all 6 accounts, create the monthly statement then print the account info
print a February header
for all 6 accounts, create the monthly statement then print the account info
withdraw 500 for each account
print a match header
<>9.for all 6 accounts, create the monthly statement then print the account info
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started