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, 23.06.2019 05:00
In cell b18, enter a formula to calculate the amount budgeted for meals. this amount is based on the daily meal allowance and the total travel days (# of nights+1).
Answers: 1
question
Computers and Technology, 23.06.2019 06:10
The head restraint should be adjusted so that it reaches a.the top of your ears b.the base of your skull c.the top of the head
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Enzo’s balance sheet for the month of july is shown. enzo’s balance sheet (july 2013) assets liabilities cash $600 credit card $4,000 investments $500 student loan $2,500 house $120,000 mortgage $80,000 car $6,000 car loan $2,000 total $127,100 total $88,500 which expression finds enzo’s net worth?
Answers: 1
question
Computers and Technology, 25.06.2019 08:10
A(n) is a step-by-step direction for performing a specific task, which is written in a language the computer can understand.servercachearrayprogram
Answers: 1
You know the right answer?
Can you debug the following code using the given test code?public class SavingAccount{ // interest r...
Questions
question
English, 01.08.2019 18:00
question
Mathematics, 01.08.2019 18:00
Questions on the website: 13722360