Showing posts with label compound interest solver. Show all posts
Showing posts with label compound interest solver. Show all posts

Tuesday, September 30, 2014

Compound Interest Solver in JavaScript

One of my favorite scripting programming language is JavaScript in this program I wrote a simple Compound Interest Solver that will solve for the interest rate for the loan made by the person. The code is very simple and easy to understand, I'm using notepad++ as my test editor in writing this program.

If you have some questions about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

Thank you very much.


Sample Output of Our Program


Program Listing

<!-- Written By: Jake R. Pomperada, MAED-IT  2014-->
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var princ;
var ratepc;
var years;
var rate;
var power;
function calcAmt(frm) {
princ = eval(frm.pr.value);
ratepc = eval(frm.rt.value);
years = eval(frm.yr.value);
rate = ratepc / 100;
power = Math.pow((1 + rate), years);
frm.amt.value = Math.round(princ * power * 100) / 100;
frm.inter.value = Math.round((frm.amt.value - princ) * 100) / 100;
}
function checkInput(frm) {
if (rate == 0 || rate > .3) {
window.alert ("Are you sure that the interest rate is " + ratepc +"%?");
frm.rt.focus();
}
if (years == 0 || years > 30) {
window.alert ("Are you sure that the term is " + years + " years?");
frm.yr.focus();
   }
}
//  End -->
</script>

</HEAD>


<BODY BGCOLOR="LIGHTGREEN">

<center>
<hr>
<h1> <font face="comic sans ms"> COMPOUND INTEREST SOLVER  </h1>
<hr>
<br> <br>
<font size=5>
<form method=get name=frm>
Principal <input type=text name=pr size=10 maxlength=10 onChange=calcAmt(this.form)>
Rate <input type=text name=rt size=6 maxlength=6 onChange=calcAmt(this.form)>
Years <input type=text name=yr size=5 maxlength=5 onChange=calcAmt(this.form)>
<br>
<br>
<input type=button name=calc value="Calculate" size=10 onClick=checkInput(this.form); calcAmt(this.form);>
<input type=reset value="Clear">
<br>
<br>
Amount <input type=text name=amt size=10>
Interest <input type=text name=inter size=10>
</form>
</font>
</font>
</center>
</body>
</html>


Tuesday, July 29, 2014

Compound Interest Solver Using JavaScript

In today's world business plays an important role in our economy they make our nation growth, it generates jobs to our people and make our live much comfortable because we have money to spend in our day to day expenses such as foods, shelter, clothing and other basic human needs. In reality in life most of the time the income that we earn from our jobs is not sufficient enough to fill up our needs because of high cost of basic commodities like food ans shelter for example.

Most of us the easiest way is to lend money from a bank or lending institution but lending money is not an easy we must have to consider our capacity to pay such loan to avoid penalty such as big amount of monthly interest for the money that we lend from a bank or financial institution.  In this article I would like to share with you a simple program that I used in JavaScript to compute the compound interest rate of the money being loaned so that the user will able to learn and understand how much he or she must able to save and to pay for the loan they get from a bank or any lending institution.

The code is not difficult to understand it can run directly in any web browser without any problem because JavaScript programs are programs that runs on a client computers it does not need to run on the Internet most of the time. I hope you will find my work useful in your programming projects and assignments if you are using JavaScript as your developmental language of choice.

If you have some questions about my work feel free to send me and email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

Thank you very much.



Sample Output of Our Program