Use a shared class variable to store the annual


Create class savingAccount. Use a shared class variable to store the annualInterestRate for all SavingAccounts. Each object of the class contains a Private instance variable savingBalance indicating the amount the saver currently has on deposit. Provide the calculateMonthlyInterest method to calculate the monthly interest by multiplying the savingsBalance by the annualInterestRate divided by 12; this interest should be added to savings balance and returned to the method caller. Provide a shared modifyInterestRate that sets the annualInterestRate to a new value. Write an application to test class SavingsAccount. Instantiate two SavingsAccount objects, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to 4% then calculate the monthly interest and display the amounts of interest earned and the new balances for each of the savers. Then set the annualInterestRate to 5% and calculate the next month's interest and display the amounts of interest earned and the new balances for each of the savers.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Use a shared class variable to store the annual
Reference No:- TGS0110296

Expected delivery within 24 Hours