Computers and Technology

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); }}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 22:50, savagesquid4807
Before you enter an intersection on a green light make sure
Answers: 2
image
Computers and Technology, 22.06.2019 04:30, nickddj12
Kyle, a receptionist for a building supply company, recently won an award for saving his company money on their phone system. after being presented with kyle's research, the company changed the way in which it made long-distance phone calls and cut their expenses in this area by 75 percent. the new system the kyle's company most likely adopted was wired communications switching stations voip hdtv
Answers: 3
image
Computers and Technology, 22.06.2019 10:30, darrengresham999
Choose the best explanation for the following statement communication is symbolic
Answers: 3
image
Computers and Technology, 24.06.2019 07:30, LuckyCharms988
Consider the folloeing website url: what does the "http: //" represent? a. protocal identifier. b. ftp. c. domain name d. resource name
Answers: 2
Do you know the correct answer?
Can you debug the following code using the given test code?public class SavingAccount{ // interest r...

Questions in other subjects:

Konu
Mathematics, 01.07.2019 15:00