I can't get this script to perform a loop to calculate ten years of an output. Can someone tell me what I'm missing?
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1-strict.dtd">
<!-- Exercise 8.8.html -->
<!-- Product for odd integers -->
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<title>Calculating compound interest</title>
<style type = "text/css">
table { width: 100% }
th { text-align: left }
</style>
<script type = "text/javascript">
<!--
var amount;
var principal = 1000.0;
var rate = .05
for ( var counter = 1; counter <= 10; ++rate )
document.writeln(
“<table border = \”1\”>” );
document.writeln(
“<caption>Calculating Compound Interest</caption>” );
document.writeln(
“<thead><tr><th>Year</th>” );
document.writeln( “</tr></thead><tbody>” );
<-- this for statement should be indented within the main one
for ( var year = 1; year <= 10; ++year )
rate = rate + .01;
{
amount = principal * Math.pow( 1.0 + rate, year );
document.writeln( "<td><tr>" + year +
"</td><td>" + amount.toFixed(2) +
"</td></tr>" );
}
document.writeln( "</tbody></table>" );
</script>
</head><body></body>
</html>



