Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class named AccountSaving s . This class has a static double variable which stores the annual interest rate for all account holders. The

Create a class named AccountSaving s . 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 saving s Balance which stores ba lance for current account.

a . Write a constructor to create a n 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 saving s Balance by annualInterestRate divided by 12 the interest should be added to saving s Balance .

c . Write a static method named modifyInterestRate to set the annual i nterest rate. Add a validation whether the rate is g reater than equal to 0.0 and less than or equal 1.0. Otherwise, throw an exception.

d . Write a toString method which returns savingsBalance i n a string format.

After that, create AccountSaving s T est class. Create two object s from the class AccountSaving s with balances $2000.00 and $3000.00. Then, set the interest rate to 4%, then calculate the monthly interest r ate for each 12 months for each object and print the new balances with toString method for each object. UPLOAD AccountSavings.java AND AccountSavingsTest.java .

Example Output:

image text in transcribed

Monthly balances for one year at .04 Balances Saver 1 Saver 2 $2000,00 $3000,00 $2006,67 $3010,00 Base Month 1: Month 2: $2013,36 $3020,03 Month 3: Month 4: Month 5: Month 6: Month 7: Month 8: Month 9 $2060,81 $3091,21 Month 10: $2067,68 $3101,51 Month 11: $2074,57 $3111,85 Month 12: $2081,48 $3122,22 $2020,07 $3030,10 $2026,80 $3040,20 $2033,56 $3050, 33 $2040, 33 $3060,50 $2047,14 $3070,70 2053,96 $3080,94

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

Ty e2y Evaluate the integral dy

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago