Hi All!
I'm a bit stuck on an assignment to create a mortgage calculator using java script.
I have been given the following function as part of the program:
function Monthly(I, N, S) {
// I = Yearly interest rate;
// N = Number of monthly payments;
// S = Loan amount;
return (S*I/12*Math.pow(I/12+1,N))/(Math.pow(I/12+1,N)-1);
}
I am suposed to create another function called ShowVal() which is suposed to 1) extract values from the interest rate, number of payments, and loan amount fields. 2)call the Monthly() function (Shown above) with the values extracted by the ShowVal() function. and 3) assign the value from the Monthly() function to the Monthly payment field.
Here is what I have come up with, but I can't for the life of me get it to work:
function ShowVal() {
var I=eval(document.CALC.INT.value);
var N=eval(document.CALC.NUM.value);
var S=eval(document.CALC.AMT.value);
Monthly(I, N, S);
return Monthly();
document.CALC.MON.value=ShowVal();
}
I give up. Anyone have any ideas?
Thanks!
Steve