Skip to main content
Participant
March 29, 2010
Question

Creating Mortgage Calculator

  • March 29, 2010
  • 2 replies
  • 977 views

http://www.portraitofanger.com/flash/mortgage_calc_as2.fla

Here is the flash file, I feel as if I am almost there, but the calculation doesn't add up.


submit_btn.onRelease = function()
{
     var p:Number = parseInt(amount.text);
     var r:Number = parseInt(percentage.text) / 100 / 12;
     var n:Number = parseInt(years.text) * 12;
   
     var a:Number = ((p * r) * Math.pow(1 + r, n)) / (Math.pow(1 + r, n) - 1);

     results.text = Math.round(a*100)/100;
}

This topic has been closed for replies.

2 replies

Participant
November 30, 2010

Very Helpful Forum and quite an interesting topic as well !!!
Keep It Up !!

kglad
Community Expert
Community Expert
March 29, 2010

what's wrong with it?

schlooieAuthor
Participant
March 29, 2010

The math doesn't add up, I feel there is a () missing or something.

When I do the actual math, I'm usually $50-60 off. Confusing.

kglad
Community Expert
Community Expert
March 29, 2010

i don't see a problem (except you require interest to be an integer).  give an example of an incorrect calculation.