Working on a Real Estate Second Mortgage Calculator?
This may not be the best place to ask, but maybe someone else has done what
I'm trying to do.... I'm working on a CDrom for a real estate company, and
they'd like to be able to put a "Mortgage Payment Calculator" on the disc.
This would allow a prospective home buyer to enter his/her purchase price,
or rather the amount of the loan, along with interest rate and length of the
repayment schedule and the calculator would estimate their house payment
with a reasonable degree of accuracy.
For example they'd type in $50,000 loan at 7.25% for 20 years, click an
"enter" button, and the program would return the amount of their house
payment based on that criteria.
Has anyone used anything like that and would you share your source with me?
The realty company is not opposed to paying a modest license fee for use of
same. I sure don't know how to create one so I'm going to have to find an
existing one that I can incorporate into a director presentation. (Or flash
if necessary)
Here is a function. Just put it in a movie script and call it as needed.
There is no error handling included, but you could add some as desired. For
example if you pass innappropriate values (negative numbers, letters,
commas, etc) to the function, it will fail .
If this is in a movie script, you can test it in the command window: type
put calcMortgagePayment(100000,8,30)
and press ENTER
Result shows what the mortgage payment would be for a $100,000 loan at 8%
for 30 years.
Now for the disclaimer. Use this code at your own risk. Author is not
responsible for any damages, losses, or inaccuracies. Code is provided as
is, without warranty or guarantees, either expressed or implied. User
should varify accuracy independently.
---CODE STARTS HERE
on calcMortgagePayment P, I, L
--P = principal, the initial amount of the loan
--I = the annual interest rate (from 1 to 100 percent)
--L = length, the length (in years) of the loan
I = float(I)
J = I / (12 * 100) -- assumes 12 payments per year
N = L * 12 -- assumes 12 payments per year
X = 1 + J
Y = 1 + J
repeat with counter = 2 to N
X = X * Y
end repeat
the floatprecision = 2
Return (1 / (1 - (1/X))) * J * P
end
---CODE ENDS HERE