Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello I need help with this java programming. Savings Account Class: Create class SavingsAccount. Use a static variable annuallnterestRate to store the annual interest rate
Hello I need help with this java programming.
Savings Account Class: Create class SavingsAccount. 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 savingsBalance indicating the amount the saver currently has on deposit. Provide method calculateMonthlylnterest to calculate the monthly interest by multiplying the savingsBalance by annuallnterestRate divided by 12- this interest should be added to savingsBalance. Provide a static method setinterestRate that sets the annuallnterestRate to a new value. There should also be a method setSavingsBalance to set the initial savings balance for a new saver or you can do it through a constructor. Finally, a getSavingsBalance method is needed to return the current balance. Write a program to test class SavingsAccount. Instantiate two SavingsAccount objects, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively. Set annuallnterestRate to 4%, then calculate the monthly interest for each 12 months and print the new balances for both savers. Next set the annualinterestRate to 5%, calculate the next month's interest and print the new balances for both savers. Put the code to test the class in the main method of the SavingsAccount Class. The output of your program should look like the following, where each column is separated by a tab: Month Saverl Saver2 2006.67 3010.00 2013. 36 3020-03 2020.87 3030.18 2026.80 3040.20 2033.56 3050.33 2040.33 3060.50 2047.14 3070.70 2053.96 3080.94 2060.81 3091.21 2067.68 3101.51 2074.57 3111.85 2081.48 3122.22 2098.16 3135.23 10
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