In: Computer Science
Create a SavingsAccount class to store data of savers (account
holders). Your class should match the following
specifications.
1. Each instance of the class contains a private data member
savingsBalance indicating the amount the saver currently has on
deposit, saver’s name, saver’s CNIC, account number (this has to be
unique) and a member to store saver status (if savingsBalance >
10000 then status changes to gold otherwise silver).
2. Class also has a data member annualInterestRate to store the
annual interest rate which will be the same for all the
savers.
3. Implement a default constructor with minimum savingsBalance of
100, and other fields as well. Also create a parameterized
constructor if a customer wants to open an account with a different
starting balance.
4. Provide member function calculateMonthlyInterest that calculates
the monthly interest by multiplying the savingsBalance by
annualInterestRate divided by 12; this interest should be added to
savingsBalance.
5. Provide a recursive member function turnInToGold that returns
the number of months a saver need to become gold member
6. Provide a member function modifyInterestRate that sets the
annualInterestRate to a new value.
7. Provide a function that returns the total number of account
holders with the bank.
8. Write main() to test class SavingsAccount . Instantiate two
different objects of class SavingsAccount, s1 and s2, with balances
of $2000.00 and $3000.00, respectively. Set the annualInterestRate
to 3 percent. Then calculate the monthly interest and print the new
balances for each of the savers. Then set the annualInterestRate to
4 percent, calculate the next Month’s interest and print the new
balances for each of the savers. Also print the months it will take
for both to become gold savers of bank.