Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code needs to be in Java Thanks in advance for the help. ------------------------------------------------ Create class SavingsAccount . Use a static variable annualInterestRate to store the

Code needs to be in Java

Thanks in advance for the help.

------------------------------------------------

Create class SavingsAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance indicating the amount the saver currently has on deposit. Provide method calculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12this interest should be added to savingsBalance. Provide a static method modifyInterestRate that sets the annualInterestRate to a new value.

Write a program called SavingsAccountTest 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 for each of 12 months and print the monthly balances for both savers. Next, set the annualInterestRate to 5%, calculate the next months interest and print the new balances for both savers.

------------------------------------------------

This code must follow a few rules:

-SavingsAccount is a public class

-annualInterestRate is a private class variable

-savingsBalance is a private instance variable

-calculateMonthlyInterest is a public instance method

-calculateMonthlyInterest is correctly implemented

-modifyInterestRate is a public class method

-modifyInterestRate is correctly implemented

-Test program instantiates two SavingsAccount objects

-Test program sets the annualInterestRate to 4%

-Test program calculates the monthly interest for each of the 12 months and prints the monthly balances for both SavingsAccount instances as a table

-Test program sets the annualInterestRate to 5%

-Test program calculates the monthly interest for the next month's interest and prints the balances for both SavingsAccount instances.

-Test program is in a public class called SavingsAccountTest

------------------------------------------------

If you have any questions about the problem, please make a comment and I can update with the necessary info (if I have it)

Thanks again

Since the formatting in text is weird, screenshots will be provided below:

image text in transcribed

image text in transcribed

Problem 2 Create class Savings Account. Use a static variable annuallnterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savings Balance indicating the amount the saver currently has on deposit. Provide method calculateMonthlyInterest to calculate the monthly interest by multiplying the savings Balance by annuallnterestRate divided by 12-this interest should be added to savings Balance. Provide a static method modifyinterest Rate that sets the annuallnterestRate to a new value. Write a program called Savings Account Test to test class Savings Account. Instantiate two Savings Account objects, saver 1 and saver 2, with balances of $2000.00 and $3000.00, respectively. Set annuallnterestRate to 4%, then calculate the monthly interest for each of 12 months and print the monthly balances for both savers. Next, set the annualInterestRate to 5%, calculate the next month's interest and print the new balances for both savers. Problem 2: Savings Account is a public class Problem 2: annuallnterestRate is a private class variable Problem 2: savings Balance is a private instance variable Problem 2: calculateMonthlyInterest is a public instance method Problem 2: calculate MonthlyInterest is correctly implemented Problem 2: modifyInterestRate is a public class method Problem 2: modifyInterest Rate is correctly implemented Problem 2. Test program instantiates two Savings Account objects Problem 2: Test program sets the annualInterestRate to 496 Problem 2: Test program calculates the monthly interest for each of the 12 months and prints the monthly balances for both Savings Account instances as a table Problem 2: Test program sets the annualInterest Rate to 5% Problem 2: Test program calculates the monthly interest for the next month's interest and prints the balances for both Savings Account instances. Problem 2: Test program is in a public class called SavingsAccount Test

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

5.2 Summarize the environment of recruitment.

Answered: 1 week ago