Tuesday, May 1, 2018

Compound Interest Solver in JavaScript Version 2

A very simple compound interest solver in Javascript version 2 that I wrote while learning JavaScript programming.

I am currently accepting programming work, it project, school programming projects , thesis and capstone projects, IT consulting work and web development work kindly contact me in the following email address for further details.  If you want to advertise in my website kindly contact me also in my email address also. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.




Sample Program Output

Program Listing

index.htm

<HTML>
<TITLE> COMPOUND INTEREST SOLVER IN JAVASCRIPT </TITLE>
<STYLE>

BODY {
   FONT-FAMILY:ARIAL;
   FONT-SIZE:15PX;
    };
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
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();
   }
}
</script>

</HEAD>

<BODY BGCOLOR="LIGHTGREEN">

<BR>
<center>
<table width=600 cellpadding=0 cellspacing=10>
<tr>
<td width=468 align=center>

    
    
</td>
<td width=120 align=center>
    
</td>
</tr>
</table>
<BR>
<BR>
<basefont size=3>
<FONT SIZE="+2" FACE="Helvetica,Arial">
<FONT COLOR="blue"><b>Compound Interest Solver in JavaScript</b></font></font>
<BR>
<FONT COLOR="blue"><b>Written By. Mr. Jake R. Pomperada, MAED-IT</b></font></font>
<table BORDER=0 WIDTH=486 CELLPADDING=3 CELLSPACING=0>
<tr><td><font FACE="helvetica,arial,geneva">
<br>

</td></tr>
</table>

<center>
<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>
</center>
</BODY>
</HTML>

No comments:

Post a Comment