Question
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
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 savingsBalance indicating the amount the saver currently has on deposit. 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. Provide a static member function modifyInterestRate that sets the static annualInterestRate to a new value.
Write a main program to test your class. Your program should prompt the user to enter the savingsBalance for two different accounts. It should ask for the annualInterestRate. It should then compute and print the new balance for both the accounts. A sample run would be:
Please enter the savings balance of account 1: 2000
Please enter the savings balance of account 2: 3000
Please enter the annual interest rate: 3
The interest for account 1 would be $5.00 and the balance after one month would be $2005.00
The interest for account 2 would be $7.50 and the balance after one month would be $3007.50
Would you like to change the interest rate? (Y or N): Y
Please enter the annual interest rate: 6
The interest for account 1 would be $10.00 and the balance after one month would be $2010.00
The interest for account 2 would be $15.00 and the balance after one month would be $3015.00
Would you like to change the interest rate? (Y or N): N
Goodbye!
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