Showing posts with label compounded interest solver in javascript. Show all posts
Showing posts with label compounded interest solver in javascript. Show all posts

Thursday, November 12, 2015

Compounded Interest Solver In JavaScript

A simple program that I wrote in JavaScript programming language that will compute the compounded interest rate from the money being borrowed by the person. The code is very simple and very easy to understand. I intended my work for beginners in JavaScript programming.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.



Sample Program Output

Program Listing


<html>
 <head>
    <title>
 Compounded Interest Solver
 </title>
 </head>
 <style>
        h3 {
    font-family:arial;
    }
</style>  
 <body>
  <h3> Compounded Interest Solver</h3>
<script>

 var principal=0,years=0,rate=0;
   principal = 10000;
   years  = 10;
   rate = .05; 
   
 document.write("<font face='arial' size='4'> ");
 document.write("Principal Amount    :  Php " + principal + "</font><br>");
  document.write("<font face='arial' size='4'> ");
  document.write("Years    : " + years + "</font><br>");
  document.write("<font face='arial' size='4'> ");
  document.write("Interest Rate : " + rate + "</font><br>");
  document.write("<font face='arial' size='4'> ");
  document.write("<br>");
  document.write("Total Amount Compounded over the " + years +" years.</font>");
  document.write("<br><br>");
   for(x=1; x<=years; x++) {
amount = parseFloat(principal) * Math.pow(1+parseFloat(rate),x);
    document.write("<font face='arial' size='4'> ");
document.write("Year " + x  + " : Php "  + amount.toFixed(2) +"</font><br>");
}
  </script> 
  </body>
 </html>