Question: 1. 2 + In the Savings Account class, declare/Initialize variables based on the table below. Develop a simple program for an individual savings account.

1. Develop a simple program for an individual savings account. Create two (2) classes named Savings Account (no class modifie 

1. 2 + In the Savings Account class, declare/Initialize variables based on the table below. Develop a simple program for an individual savings account. Create two (2) classes named Savings Account (no class modifier) and Run Savings Account (public). Data Type double double Access Level Static? Variable Name balance interestRate private public No Yes Value None 0 3. Within the constructor, initialize balance with the value of 0. 4. Declare a static setter method named setInterestRate with a parameter of double type named newRate. This method should assign newRate to interestRate. All methods in the program should be public. 5. Add a static method named getinterestRate and a non-static method named getBalance, where each returns an appropriate variable. Both should of double type. 6. Declare a void method named deposit with a parameter of double type named amount. This method should update balance by adding an amount to it. 7. Add another method of double type named withdraw with a parameter of double type also named as amount. Create an if-else statement based on this condition: If balance is greater than or equal than amount, deduct amount from balance; else, amount is equal to 0. Return the amount afterwards. 8. Add a void method named addinterest. Within this method, declare a double variable named interest that accepts the product of balance and interestRate. Update balance by adding interest to it. 9. Declare a void static method named showBalance with a parameter of Savings Account type named account. This method should display the current balance of the account by calling the getBalance() method using the object account. 10. Move to the other class, Run Savings Account. Import the Scanner class for the user input. 11. Instantiate a Savings Account object named savings in the main method to use the methods you have created earlier. This should be the expected sequence of the program upon execution: a. Ask the user to input the interest rate. b. C. Ask the user to type an amount to be deposited. Ask the user to press either D for another deposit or W for withdraw. Show balance afterward. If savings is greater than 1000, display the new balance with applied interest.

Step by Step Solution

3.54 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

SavingsAccountjava public class Savings Account private static double balance public double inte... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Human Resource Management Questions!