In order to design this program, I need to explain some financial concepts. The term loan amortization means the computation of the amount of equal periodic payments necessary to provide lender with a specific interest return and repay the loan principal over a specified period. The loan amortization process involves finding the future payments whose present value at the load interest rate equal the amount of initial principal borrowed. Lenders use a loan amortization schedule to determine these payment amounts and the allocation of each payment to interest and principal.
The formula to calculate periodic payment is payment=Initial Principal/PVIFAn, where PVIFAn is known as present value interest factor for an annuity . The formula to compute PVIFAn is 1/i - 1/i(1+i)n where n is the number of payments. Normally you can check up a financial table for the value of PVIFAn and then calculate the payments manually. You can also use a financial calculator to compute the values. However, if you already know how to program in VB, why not create your very own financial calculator.
To calculate the payments for interest, you can multiply the initial principal with the interest rate, then use periodic payment to minus payment for interest. To calculate the balance at the end of a period, use the formula
End-of_year principal=Beginning-of-year principal-periodic payment
The Interface
P = Txt_Principal.Text
Num = Txt_Num_payment.Text
r = Txt_Interest.Text
I = r / 100
PVIFA = 1 / I - 1 / (I * (1 + I) ^ Num)
pmt = P / PVIFA
Lbl_Amtpayment.Caption = Round(pmt, 2)
End Sub
Private Sub Cmd_Create_Click()
List_Amortization.AddItem "n" & vbTab & "Periodic" & vbTab & vbTab & "Payment" & vbTab & vbTab & "Payment" & vbTab & vbTab & "Balance"
List_Amortization.AddItem "" & vbTab & "Payment" & vbTab & vbTab & "Interest" & vbTab & vbTab & "Principal"
List_Amortization.AddItem "_______________________________________________________________________"
Do
n = n + 1
PI = P * I
PP = pmt - PI
P = P - PP
List_Amortization.AddItem n & vbTab & Round(pmt, 2) & vbTab & vbTab & Round(PI, 2) & vbTab & vbTab & Round(PP, 2) & vbTab & vbTab & Round(P, 2)
If n = Num Then
Exit Do
End If
Loop
End Sub
Private Sub Cmd_Reset_Click()
Txt_Principal.Text = ""
Txt_Interest.Text = ""
Txt_Num_payment.Text = ""
Lbl_Amtpayment.Caption = ""
List_Amortization.Clear
n = 0
End Sub
Private Sub Command4_Click()
End
End Sub
The legal tricks-Learn Your Self
Latest gadgets,softwares,hardware,reviews,programming and campuses, game cheats ext......
Code:
Public Sub Cmd_Calculate_Click()
Labels: Programming, Visual Basic
Subscribe to:
Post Comments (Atom)
1 comments:
An interesting and informative post.Thank you for sharing.
--------
online financial calculator
Post a Comment