Answered step by step
Verified Expert Solution
Question
1 Approved Answer
b. (100pts) Implement the class Savings Account according to the following UML: Savings Account -annual InterestRate: double -balance: double +Savings Account(balance: double) +calculateMonthly Interest():
b. (100pts) Implement the class Savings Account according to the following UML: Savings Account -annual InterestRate: double -balance: double +Savings Account(balance: double) +calculateMonthly Interest(): double The annual interest rate for each saving account. The account balance. Constructs an account object with a specified balance. Returns the monthly interest. The interest should be added to savingsBalance. +modifyInterest Rate (annual Interest Rate: double): void Sets a new annual InterestRate. +getBalance(): double +setBalance(balance: double): void Return the balance. Set a new balance. Use a private static data field to store the annualInterestRate for each of the savers. Each instance of the class contains a private instance data field savingsBalance, indicating the amount the saver currently has on deposit. Provide method calculateMonthly Interest to calculate the monthly interest by multiplying the savingBalance by annualInterestRate divided by 12; this interest should be added to savingsBalance. Provide a static method modify InterestRate that sets the annualInterestRate to a new value. Provide one constructor which takes a double type parameter to initialize the savingsBalance. C. (100 pts) Based on the previous Savings Account, write a test program called TestSavings Account that should do the following tasks: 1) Create a savings account object called myAccount with $10,000. 2) Set the annual interest rate as 6%, which is 0.06. 3) Calculate and display monthly interest of the account. 4) Display the new balance of the account. A sample output: The original balance is $10000.0 The monthly interest is $50.0 The new balance is $10050.0
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