Forum Moderators: open

Message Too Old, No Replies

365 Day A Year Loan Calculator

         

web_young

11:01 pm on Aug 19, 2004 (gmt 0)

10+ Year Member



I'm looking for a loan calculator that will calculate a loan on a 365 day year. All of the ones that I've been able to find have used 360 days. So when I input my info the end payment result is a little bit off. Any advice would be appreciated.

coopster

11:15 pm on Aug 19, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How about just find and replace within one of the calculators you found? Find 360, replace with 365?

web_young

2:24 pm on Aug 20, 2004 (gmt 0)

10+ Year Member



I thought it would be that easy too, but when I looked at the code for the calculator I have been using I didn't see 360 anywhere. I'm not familiar with Javascript enough to know how it's calculating the final payment. Maybe somebody here could help me. Here's the code I've been using:

<script LANGUAGE="JavaScript">

function jumpBox(list) {
location.href = list.options[list.selectedIndex].value
}

function checkNumber(input, min, max, msg)
{
msg = msg + " field has invalid data: " + input.value;

var str = input.value;
for (var i = 0; i < str.length; i++) {

var ch = str.substring(i, i + 1)
if ((ch < "0" ¦¦ "9" < ch) && ch!= '.') {
alert(msg);
return false;
}
}
var num = 0 + str
if (num < min ¦¦ max < num) {
alert(msg + " not in range [" + min + ".." + max + "]");
return false;
}
input.value = str;
return true;
}

function computeField(input)
{
if (input.value!= null && input.value.length!= 0)
input.value = "" + eval(input.value);
computeForm(input.form);
}

function computeForm(form)
{
if ((form.payments.value == null ¦¦ form.payments.value.length == 0) ¦¦
(form.interest.value == null ¦¦ form.interest.value.length == 0) ¦¦
(form.principal.value == null ¦¦ form.principal.value.length == 0)) {
return;
}

if (!checkNumber(form.payments, 1, 480, "# of payments") ¦¦
!checkNumber(form.interest, .001, 99, "Interest") ¦¦
!checkNumber(form.principal, 100, 10000000, "Principal")) {
form.payment.value = "Invalid";
return;
}

var i = form.interest.value;
if (i > 1.0) {
i = i / 100.0;
form.interest.value = i;
}
i /= 12;

var pow = 1;
for (var j = 0; j < form.payments.value; j++)
pow = pow * (1 + i);
form.payment.value = (form.principal.value * pow * i) / (pow - 1);

form.totalint.value = (form.payment.value * form.payments.value)
- form.principal.value
}

function clearForm(form)
{
form.payments.value = "";
form.interest.value = "";
form.principal.value = "";
}

</script>

Cochrane

11:54 am on Sep 3, 2004 (gmt 0)

10+ Year Member



Web Young:
Microsoft has a free loan amortization object. If you send me a PM, with your email, I will attach the file to you in reply.