I have a question for my Javascript class that i need help with
This is what I need to do
“Create an application that allows a Customer to enter an initial deposit (for example $1000), an annual interest rate (say 12%, which is 1% per month) and a target savings amount (say $2000). Each month they contribute an extra $10 to their account. Determine how many months it will take for the customer to reach this target amount. “
I have done this but its not quite working could someone please help
[CODE]<script type=”text/Javascript”>
function calc(){
intDep = document.form1.txtDep.value
intInt = document.form1.txtInt.value
intTar = document.form1.txtTar.value
intCont = document.form1.txtCont.value
intpermonth= (intInt / 12)
intActual = (intpermonth / 100)
intCount = 0
intBanked = intDep
do {intBanked = (intBanked + intCont + (intBanked * intActual));
intCount++;}
while ((intBanked + intDep) < intTar);
document.form1.txtMonths.value = intCount
}
</script>
</head>
<body>
<form name=”form1″>
Enter your deposit <input type=”text” name=”txtDep” /><br />
Enter your Interest rate <input type=”text” name=”txtInt” /><br />
Enter your Target savings <input type=”text” name=”txtTar” /><br />
Your required monthly contibution is <input type=”text” name=”txtCont” readonly=”readonly” value=”10″ /><br />
<br />
<input type=”button” name=”go” value=”calculate” onclick=”calc()” />
<br />
It will take <input type=”text” name=”txtMonths” readonly=”readonly” /> months to reach your target
</form>
</body>