Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a programme to solve a formula for compound interest
using html tags. I want to know how a formula containing
degree (raise to the power) can be solved.

Answer Posted / mangala

<html>
<head>
<script language="JavaScript">
function calculate(formObj)
{
var presentVal = parseFloat(formObj.principalVal.value);
var intRate = parseFloat(formObj.intRate.value)/100.;
var years = parseFloat(formObj.years.value);

var futureVal = presentVal * Math.pow((1.0+intRate),years);
var totalInt = futureVal - presentVal;
futureVal = Math.round(futureVal*100.0)/100.0;
totalInt = Math.round(totalInt*100.0)/100.0;

formObj.futureVal.value = futureVal;
formObj.totalInt.value = totalInt;

return;
}
</script>
</head>

<body>
<h5>Compound Interest Calculator</h5>
<form name="myform">
<pre>
Principal amount : <input type="text"
name="principalVal">
Interest Rate(%) : <input type="text" name="intRate">
Years of Compounding: <input type="text" name="years">
<input type="button" name="calc" value="Calculate"
onclick="calculate(myform)">
</pre>
<hr>
<pre>
Total Interest: <input type="text" name="totalInt">
Future Value: <input type="text" name="futureVal">
<pre>
</form>

</body>
</html>

The raise to the power can be solved using Math.pow method
in javascript.

Is This Answer Correct ?    14 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you have to declare variables in javascript?

898


coding of java scripts

1890


What is an empty html tag?

842


What are the difference between javascript and jquery?

1018


Write a way by which you can do something on the close of the window ?

1042


What typeof returns for a null value?

979


Describe the properties of an anonymous function in JavaScript?

1186


What is the data type of variables of in javascript?

907


Where do I put javascript in html?

790


What is Number object in JavaScript?

1005


Is null === undefined?

863


Explain unescape() and escape() in javascript?

909


How do I run javascript on my iphone?

909


What is "this"?

874


What is the use of Void(0)?

1015