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 09:50
Allison and her group have completed the data entry for their spreadsheet project. they are in the process of formatting the data to make it easier to read and understand. the title is located in cell a5. the group has decided to merge cells a3: a7 to attempt to center the title over the data. after the merge, allison points out that it is not centered and looks bad. where would the title appear if allison unmerged the cells in an attempt to fix the title problem?
Answers: 2
question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
Anewly established internet company with 40 employees needs your advice. they are looking for a collaboration tool and have narrowed their choices to gotomeeting, webex, and my web conferences. after reading the information presented in this chapter and other sources, prepare a two- page document ( double spaced) that includes two advantages and two disadvantages of each tool. which one is your final recommendation? why did you choose that tool over the other two?
Answers: 3
question
Computers and Technology, 24.06.2019 18:30
Dereck works for long hours on his computer.  he frequently experiences physical strain by the end of the day because he does not follow an important rule of ergonomics with respect to the use of keyboards.  which of the following actions of dereck could lead to physical strain? a.  placing the keyboard exactly in front of him while typingb.  keeping hands and wrists straight while typingc.  using wrist pads throughout the dayd.  pounding at the keys on the keyboard while typinge.  resting his hands on the keyboard when he is not typing
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
Mathematics, 17.02.2021 19:20
question
History, 17.02.2021 19:20
Questions on the website: 13722367