Question: Modify the compound-interest application of Fig. 4.6 to repeat its steps for interest rates of 5%, 6%, 7%, 8%, 9% and 10%. Use a for

Modify the compound-interest application of Fig. 4.6 to repeat its steps for interest rates of 5%, 6%, 7%, 8%, 9% and 10%. Use a for loop to vary the interest rate.

Fig. 4.6

I // Fig. </p>                                                    <button class=Transcribed image text

I // Fig. 4.6: Interest.java 2 // Compound-interest calculations with for.. 3 4 5 6 7 8 9 10 12 13 14 public class Interest { public static void main(String[] args) { double principal = 1000.0; // initial amount before interest double rate= 0.05; // interest rate 15 16 17 18 19 20 21 } 1 234567899 } 10 // display headers System.out.printf("%s%20s%n", "Year", "Amount on deposit"); Year Amount on deposit 1,050.00 1,102.50 1,157.63 1,215.51 1,276.28 1,340.10 1,407.10 1,477.46 // calculate amount on deposit for each of ten years for (int year = 1; year

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The current Java program calculates compound interest for a principal amount at a fixed interest rate over ten years To modify the program to calculate compound interest for interest rates from 5 to 1... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java How To Program Late Objects Questions!