[RESOLVED] Math formula problems. PLS HELP...

Hi! Need help here.

I'm making a loan processing system using javascript. But I can't get through with the right outputs because I cant make one formula right. Here are the specifications and requirements:

__Input:__

name of borrower

loan amount

interest rate (% per annum)

term of loan (years)

__Output:__

Name of borrower

Loan amount

Interest rate

Term

Rebate (1% if years/term is less than 5 years)

Amount due (future value only... or if term is less than 5 years, F minus rebate)

__variables:__

P=present value (loan amount)

r=interest rate

n=term of loan in years

F=future value (amount due after term)

Solutions:

F= P(1+r)^n

rebate= Future value * 0.01

Amount due= if n>=5, then F, else F*0.99

Code:

`<script type="text/javascript">`

//x=prompt("Enter name of borrower: ");

//alert("Name of borrower: "+x);

name=prompt("Enter name of borrower: "," ");

P=prompt("Enter loan amount: "," ");

r=prompt("Enter interest rate (% per annum): ", " ");

n=prompt("Enter term of loan (year): ", " ");

**F=P*Math.pow(1+r, n);**

AmtDue=(n>=5)? F: F*0.99;

document.write("Name of borrower: " +name);

document.write("<br> Loan amount: PhP" +P);

document.write("<br> Interest rate: " +r +'% per annum');

document.write("<br> Term: " +n +' years <hr>');

document.write("<br> Rebate: PhP " +rebate);

document.write("<br> Amount due: PhP " +AmtDue);

</script>

I'm having problems with the solution for F(Future value)... I also used Math.pow for the exponent of 1+r which is n(term or year).When I test it with these values, it displays the wrong **Rebate** and **Amount Due**:

__Test Values:__

loan amount(P)= 100

interest rate(r)= 5

term of loan (n)= 2

__Correct Results/outputs:__

Loan amount: 100

Interest rate: 5

Term: 2

Rebate: 36

Amount due: 3600

Please help me with this... I couldn't get the correct output/results because of the equation or solution for Future value(F)... Please, and thank you in advance... :)