Create a class named AccountSavings. This class has a static double variable which stores the annual interest rate for all account holders. The name of variable is annualInterestRate. The class also has another double variable named savingsBalance which stores balance for current account.
a. Write a constructor to create an account with specified balance. Add a validation whether the balance is greater than 0.0. If it is less than 0.0 then throw an exception.
b. Write a non-static calculateMonthlyInterest method to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12 – the interest should be added to savingsBalance.
c. Write a static method named modifyInterestRate to set the annual interest rate. Add a validation whether the rate is greater than equal to 0.0 and less than or equal 1.0. Otherwise, throw an exception.
d. Write a toString method which returns savingsBalance in a string format.
After that, create AccountSavingsTest class. Create two objects from the class AccountSavings with balances $2000.00 and $3000.00. Then, set the interest rate to 4%, then calculate the monthly interest rate for each 12 months for each object and print the new balances with toString method for each object.