<%
'*************************************************
'************* ASP Implementation ****************
'*************************************************
'
'Loan Calculator by Sidney Forcier
'sf01@sidneyforcier.com
'
'The formula for calculating loan payments is:
'
' Pi / (q * (1 - (1 + (i / q))^(-nq)
'
'Where the variables are as follows:
'
' P - The amount of the loan (after down payment)
' i - The interest expressed as a decimal (e.g. 8% is .08)
' n - The number of term units (e.g. number of years)
' q - The number of payments per term unit (e.g. 12 months)
'
'You can enhance the formulas below by allowing the user to change the number
' of payments per year if you wish. I have hard-coded the payments to monthly.
Dim aspResult, p, dp, i, y
aspResult = ""
If Request.Form("cmdSubmit") <> "" Then
On Error Resume Next
p = Request.Form("aspPrincipal")
dp = Request.Form("aspDownPayment")
i = Request.Form("aspInterest") / 100
y = Request.Form("aspYears")
aspResult = ((p - dp) * i / (12 * (1 - (1 + (i / 12))^(-y*12))))
aspResult = "$" & Round(aspResult, 2)
If Err.number <> 0 Then
aspResult = "Could not compute"
End If
On Error Goto 0
End If
%>