Modify the application in Fig. 4.6 to use only integers to calculate the compound interest. Treat all

Question:

Modify the application in Fig. 4.6 to use only integers to calculate the compound interest. Treat all monetary amounts as integral numbers of pennies. Then break the result into its dollars and cents portions by using the division and remainder operations, respectively. Insert a period between the dollars and the cents portions.

 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  answer-question

Java How To Program Late Objects Version

ISBN: 9780136123712

8th Edition

Authors: Paul Deitel, Deitel & Associates

Question Posted: