Chapter 10: Problem 8
Create a savingsAccount class. Use a static data member annualinterestRate to store the annual interest rate for each of the savers. Each member of the class contains a private data member savingsBatance indicating the amount the saver currently has on deposit. Provide member function calculateMonthlyInterest that calculates the monthly interest by multiplying the balance by annualinterestRate divided by \(12 ;\) this interest should be added to savingsBalance. Provide a static member function modifyInterestrate that sets the static annualtnterestrate to a new value. Write a driver program to test class SavingsAccount. Instantiate two different objects of class SavingsAccount, saver1 and saver2, with balances of \(\$ 2000.00\) and \(\$ 3000.00,\) respectively. Set the annualtnterestRate to 3 percent. Then calculate the monthly interest and print the new balances for each of the savers. Then set the annualtnterestRate to 4 percent, calculate the next month's interest and print the new balances for each of the savers.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.