Modify the compound-interest application of Fig. 4.6 to repeat its steps for interest rates of 5%, 6%,

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 loop to vary the interest rate.

Fig. 4.6

I // Fig. </p>                                                    <div 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

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: