Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a SavingsAccount Class.Use a data member annualInterestRate tostore the a

ID: 3610801 • Letter: C

Question

Create a SavingsAccount Class.Use a data member annualInterestRate tostore the annual interest rate for each of the savers. Each memberof the class contains a private data member savingsBalanceindicating the amount the saver currently has on deposit. Providemember function calculateMonthlyInterestthat calculates the monthly interest by multiplying the balance byannualInterestRatedivided by 12; this interest should be added to savingsBalance. Providea member function modifyInterestRate thatsets the annualInterestRate to anew value. Write a driver program to test class SavingsAccount. ICreatetwo different objects of class SavingsAccount,saver1 andsaver2, withbalances of $2000.00 and $3000.00, respectively. Set theannualInterestRate to 3percent. Then calculate the monthly interest and print the newbalances for each of the savers. Then set the annualInterestRate to 4percent, calculate the next month’s interest and print thenew balance for each of the savers.

Explanation / Answer

#include #include using namespace std; class SavingsAccount { private:      double annualInterestRate;    double savingsBalance; public:    SavingsAccount();     SavingsAccount(double balance, double rate);    SavingsAccount(double balance);    double calculateMonthlyInterest();    void modifyInterestRate(double newrate);    double getSavingsBalance();    }; SavingsAccount::SavingsAccount() {        savingsBalance=0.0;    annualInterestRate=0.0; } SavingsAccount::SavingsAccount(double balance) {        savingsBalance= balance;    annualInterestRate=0.0; } /* definition of constructor 2 */ SavingsAccount::SavingsAccount(double balance, double rate) {        savingsBalance= balance;    annualInterestRate=rate; } void SavingsAccount::modifyInterestRate(double newrate) {    annualInterestRate = newrate; } double SavingsAccount::getSavingsBalance() {    return savingsBalance; } double SavingsAccount::calculateMonthlyInterest() {    double interest = (annualInterestRate *savingsBalance) /1200;    double savings= getSavingsBalance();    savingsBalance = savings+interest;     return interest; } int main() {     SavingsAccount saver1 =SavingsAccount(2000.00);    SavingsAccount saver2 =SavingsAccount(3000.00);    saver1.modifyInterestRate(3);    saver2.modifyInterestRate(3);    cout