O'Reilly logo

Web Programming with HTML5, CSS, and JavaScript by Dean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10.4 Compound Interest Web Page

Let’s put what you’ve learned into practice with a complete web page that uses a while loop and an external JavaScript file. FIGURE 10.3’s Compound Interest web page generates a table of compound interest values for a user-specified number of years. In the figure, note the initial deposit (often referred to as the “principal”) of $1000 and the interest rate of 10%. Using those values, the table’s year 1 values are calculated as follows. The interest earned is $1000 × 10% = $100, and the ending value is $1000 + $100 = $1100. To verify the table values for years 2 through 4, use the prior ending value as the new starting value and apply the same mathematical calculations.

FIGURE 10.3 Compound Interest web ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required