for ( var year = 1; year <= yearValue; ++year ) { //amount = principal * Math.pow( 1.0 + rate, year ); // 3-23-17 YL NEW 1L: calculate amount amount *= rate; if ( year % 2 !== 0 ) // 3-23-17 YL MOD 1L: add dollar sign document.writeln( "<tr class='oddrow'><td>" + year + "</td><td>$" + amount.toFixed(2) + "</td></tr>" ); else // 3-23-17 YL MOD 1L: add dollar sign document.writeln( "<tr><td>" + year + "</td><td>$" + amount.toFixed(2) + "</td></tr>" ); } //end for document.writeln( "</tbody></table><hr>" ); // 3-24-17 YL MOD 1L:add horizontal rule // 3-23-17 YL NEW 1L: read continue userContinue = window.prompt("Continue?","y"); } while(userContinue == "Y" || userContinue == "y"); // 3-23-17 YL NEW 1L: end while </script> </head><body></body> </html>
for ( var year = 1; year <= yearValue; ++year ) { //amount = principal * Math.pow( 1.0 + rate, year ); // 3-23-17 YL NEW 1L: calculate amount amount *= rate; if ( year % 2 !== 0 ) // 3-23-17 YL MOD 1L: add dollar sign document.writeln( "<tr class='oddrow'><td>" + year + "</td><td>$" + amount.toFixed(2) + "</td></tr>" ); else // 3-23-17 YL MOD 1L: add dollar sign document.writeln( "<tr><td>" + year + "</td><td>$" + amount.toFixed(2) + "</td></tr>" ); } //end for document.writeln( "</tbody></table><hr>" ); // 3-24-17 YL MOD 1L:add horizontal rule // 3-23-17 YL NEW 1L: read continue userContinue = window.prompt("Continue?","y"); } while(userContinue == "Y" || userContinue == "y"); // 3-23-17 YL NEW 1L: end while </script> </head><body></body> </html>