this is html with JavaScript inside. but it does not work. i cannot find out any errors.

////////////////////////////////////////////
// FUNCTION DEFINITION ///////////////////
////////////////////////////////////////////

/* compound — function to calculate monthly payment
* parameter A — amount of the loan
* parameter r — interest rate per period (for this calculation, each month is 1 period)
* parameter n — number of periods
* returns the future value after payment
* NOTE: A, r, and n are the traditional variable names in this equation
*/
function compound(A,r,n){
var a = A*r/(1-Math.pow(1+r,-n));
return a;
}

/* COMPOUND — fuction to calculate total interest paid
* parameter P — the monthly payment
* parameter n — the number of periods (each month is one period)
* parameter A — amount of loan
* NOTE: P, n, and A are the traditional variable names in this equation
*/
function COMPOUND(P,n,A){
var b = n*P-A;
return b;
}

Metro Bank Mortgage Calculator


//declare the variables

var amount, length, interest, LENGTH, payment, INTEREST;

//input section

var amount = parseFloat(window.prompt(“please enter the amount of loan you want”,”"));
var length = parseFloat(window.prompt(“please enter the length of loan in years”,”"));
var interest = parseFloat(window.prompt(“please enter the annual interest rate in percentage”,”"));

//process section

var LENGTH=12*length;
var payment = compound(amount,interest,LENGTH);
var INTEREST = COMPOUND(payment,LENGTH,amount);

//output sectin

document.write(“The amout of loan is $ “+amount.toFixed(2)+”
” );
document.write(“The length of loan is “+length.toFixed(2)+” years
“);
document.write(“The annual interest rate is “+interest.toFixed(2)+”%

“);
document.write(“Your monthly payment is $ “+payment.toFixed(2)+”
“);
document.write(“Your total interest paid is $ “+INTEREST.toFixed(2));

 

Related Posts
What does 1 years fixed 2.65% what does that mean?As the years go up that % is getting more why is that?Does that mean prime is inculded.is this a term ...
READ MORE
This is not sarcasm. I saw this ad on the Yahoo homepage:Homeowners: Fixed rates dropped. $ 200,000 for only $ 1,074/mo. Fixed. No SSN required. LendingTreeĀ® QuickmatchCan ...
READ MORE
HiMin Woo Kim is a mortgage broker. Last year I purchased house. Mr. Kim took loan Application from me and he applied loan for me. I was approved by one ...
READ MORE
Kim and Dan Bergholt are both government workers. They are considering purchasing a home in the Washington D.C. area for about $ 280,000. They estimate monthly expenses for utilities ...
READ MORE
What do i do to receive money from the settlement? Does anyone know how I could get a list of Loan Officers from Ameriquest Mortgage Company in Michigan?
READ MORE
As first time homebuyers, we just got an "80/20" loan. It's a first time buyer loan where they split up your mortgage into 2 separate loans (for some reason ...
READ MORE
I'm against the $ 85,000,000,000.00 bailout of AIG. Instead, I'm in favor of giving $ 85,000,000,000 to America in a We ...
READ MORE
Having so much trouble with this... any suggestions or help is much appreciated, thank you!"You put 35% down on a $ 240000 home and finance the balance through a ...
READ MORE
What portion of a familys total income is considered to determine the amount they can afford for monthly mortgage payments?a 60%b36%c 33%d 28%Ping, a 19-year-old college student, just asked his ...
READ MORE
Okay so a quick overview... Three adult kids inherit mom's house. It's been three years. Bill were kept up to date until October or so when one brother who had ...
READ MORE
Need help could someone tell me how read
Can someone explain this, please?
If someone uses two social security number, is
Someone please help?
I got a loan through Ameriquest Mortgage and
Can you help me figure out this percentage?
Why dont we do this to help our
Finance math help – which formula should I
Could someone help me with some word problems?
Could someone please help… foreclosure/selling question?

0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.