PDA

View Full Version : help with amortize (loan app)


APuppyDog
04-24-04, 02:06 PM
I have created a loan app, which calculates the monthly mortgage payment. this is how i have it constructed:

1. User inputs loan amount
2. user inputs interest rate
3. user inputs term of loan

4. there is a calculate button, when you click on that it displays the monthly mortgage amount in a seperate box.

Now I have to create an amortization table. This is what I have so far

Amortize button. Groubox with 3 colums, Month, Interest Paid, and Balance

How can i take the values from steps 1, 2, 3, 4 and use that in the amortization table to display the remaining months, interest paid each month, and the balance remaining...

Please help

schiavo
05-02-04, 10:01 PM
Forgive me, I don't want to insult your intelligence, but you know there's abuiltin functinos to do that, right? PMT and PV and FV?

OK, assuming you know that, you don't need them to create an amortizations table. You need to declare BALANCE, INTEREST, and AMORT, with a constant RATE = the monthly interest (annual interest/12), original amount, and m'ly PAYMENT.

you'll then loop until done.

Dim IntPmt, PrinPmt, NewBal
BALANCE = [original amount]
RATE = annualinterest / 12
TAB = chr(9) ' Tab character
cr = Chr(13) & Chr(10) ' New Line character
[Write to file] "BALANCE ... INT PMT ... AMORT PMT ... NEW BALANCE" & cr
Do Until Balance <= 0
IntPmt = Balance * RATE ' calc interest on current balance
PrinPmt = PAYMENT - IntPmt ' principal pmt is what's left after interest
' If Principal exceeds remaining balance, pay only that balance: we're done
If PrinPmt > BALANCE then PrinPmt = Balance
NewBal = BALANCE - PrinPmt ' subtract amortization from old balance
[write to file] Balance & TAB & IntPmt & Tab & PrinPmt & Tab & NewBal & cr
BALANCE = NewBal ' keep going till balance is paid off
loop

I have created a loan app, which calculates the monthly mortgage payment. this is how i have it constructed:

1. User inputs loan amount
2. user inputs interest rate
3. user inputs term of loan

4. there is a calculate button, when you click on that it displays the monthly mortgage amount in a seperate box.

Now I have to create an amortization table. This is what I have so far

Amortize button. Groubox with 3 colums, Month, Interest Paid, and Balance

How can i take the values from steps 1, 2, 3, 4 and use that in the amortization table to display the remaining months, interest paid each month, and the balance remaining...

Please help

APuppyDog
05-03-04, 12:02 PM
thanks, i posted the question because I have not prior experience with vb .net and was helping someone with their homework. Thanks for your reply but I finished this about 8 days ago :-)

2xr
09-08-05, 03:18 AM
thanks, i posted the question because I have not prior experience with vb .net and was helping someone with their homework. Thanks for your reply but I finished this about 8 days ago :-)

I suspect I have the same class and I am too struggling with the code. Would you be willing to supply some details as to how you accomplished the results? However detailed you like is fine. Thanks!

smartweezie
09-08-05, 11:09 AM
:confused:
Dim MonthlyPayment, principle, interestRate, tempValue As Double
Dim termYear As Integer

principle = Val(TextBox1.Text)
interestRate = (Val(TextBox2.Text)) / 100 / 12
termYear = (Val(TextBox3.Text)) * 12

tempValue = (1 + interestRate) ^ (-termYear)
If interestRate = 0 Then
MonthlyPayment = principle / termYear
Else
MonthlyPayment = principle * (interestRate / (1 - tempValue))

End If
TextBox4.Text = Format(MonthlyPayment, "currency")