subject

Can you debug the following code using the given test code?public class SavingAccount{ // interest rate for all accounts private static double annualInterestRate = 0; private final double savingsBalance; // balance for currrent account // constructor, creates a new account with the specified balance public void SavingAccount( double savingsBalance ) { savingsBalance = savingsBalance; } // end constructor // get monthly interest public void calculateMonthlyInterest() { savingsBalance += savingsBalance * ( annualInterestRate / 12.0 ); } // end method calculateMonthlyInterest // modify interest rate public static void modifyInterestRate( double newRate ) { annualInterestRate = ( newRate >= 0 && newRate <= 1.0 ) ? newRate : 0.04; } // end method modifyInterestRate // get string representation of SavingAccount public String toString() { return String. format( "$%.2f", savingsBalance ); } // end method toSavingAccountString} // end class SavingAccount Using this test codepublic class SavingAccountTest{ public static void main(String[] args) { SavingAccount s1 = new SavingAccount(400); SavingAccount s2 = new SavingAccount(1000); SavingAccount. modifyInterestRate(0.05); System. out. printf("SavingAccount 1 is: %s\nSavingAccount 2 is: %s\n", s1, s2); s1.calculateMonthlyInterest(); s2.calculateMonthlyInterest(); System. out. printf("\nSavingAccount 1 after the interest is: %s\nSavingAccount 2 after the interest is: %s\n", s1, s2); SavingAccount. modifyInterestRate(.025); s1.calculateMonthlyInterest(); s2.calculateMonthlyInterest(); System. out. printf("\nSavingAccount 1 after the new interest is: %s\nSavingAccount 2 after the new interest is: %s\n", s1, s2); }}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 19:30
Entering key dates from your course syllabi test and quiz dates, assignments due dates in your planner can you manage your schedule by allowing you to see commitments ahead of time.
Answers: 3
question
Computers and Technology, 22.06.2019 06:00
What are the most likely causes of conflict at the meeting? check all that apply.
Answers: 1
question
Computers and Technology, 22.06.2019 12:30
Which of the choices sean are not true when considering virus behavior
Answers: 1
question
Computers and Technology, 22.06.2019 19:10
10. when you create a pivottable, you need to specify where to find the data for the pivottable. is it true
Answers: 2
You know the right answer?
Can you debug the following code using the given test code?public class SavingAccount{ // interest r...
Questions
question
Mathematics, 06.04.2021 19:20
question
History, 06.04.2021 19:20
question
SAT, 06.04.2021 19:20
question
Mathematics, 06.04.2021 19:20
question
Mathematics, 06.04.2021 19:20
Questions on the website: 13722367