Auto Loan Monthly Payments Calculator

1 مشاركة في هذا الموضوع

بسم الله الرحمن الرحيم


What is an Auto-Loan ?

- Buying cars, new houses, having a pool or even a graden is every man's dream, unless you were born so rich to afford this, or you can go and get yourself a loan, this is simply what loan is. It's an amount of money that you get from a bank in order to be able to buy yourself a life (hahahaha) if you don't have one, but the catch is that you will have to pay later and you also need to be financially secured, so the bank could trust to give you such loan, anyway this is not our point.

- The bank where you will get your loan from is going to calculate some payback amounts called (monthly payment) which are the interest of the loan you have just ordered, these monthly payments is our target.

- In order to calculate the monthy payment of a loan you need to know 3 elements related to this loan :

1) How much is the loan amount ?
Is how much the bank will give to you as a loan.

2) The Interest Rate.
On what basis these monthly payments are going to be calculated, or it's some percentages % to determine the monthly payments per month

3) The period of the loan
Is how long untill the loan is to be repaid to the bank, or it is the number of months that you will pay your monthly payments (all the monthly payments)

- The Interest Rate is given by the bank, each loan system has its own Interest Rate. Interest Rates vary from bank to another and from loaner company to another, it depends on the company's or bank's willing to keep the money in your hands before they collect it + Interest .

How to calculate the monthly payments of a loan?

There are several ways to calculate the monthly payments, the accountant of the bank has its own way, so as the loaner comapny's accountant, so as the Excel user and the programmers of course have their own way.

It is a calculator, but not just any calculator, it will be made to do certain calculations resricted to certain rules, these rules are the (3 elements) we talked about above. You will need to get the Monthly Payments as an output and you will have (Loan's amount - Interest Rate - Loan's period in years or months) as inputs .

Math (Manually) calculations

Monthly payments of a $12,000 for 1 year by Interest Rate of 10% is calculated like this :

P = (Pv*R) / [1 - (1 + R)^(-n)]
Pv = Present Value (beginning value or amount of loan)
*APR = Annual Percentage Rate (one year time period)
R = Periodic Interest Rate = APR/ # of interest periods per year
P = Monthly Payment
n = # of interest periods for overall time period (i.e., interest periods per year * number of years)

Using Microsoft Excel built-In function

Even simple : Using Microsoft Excel built-In function [PMT], Syntax :

= pmt(10%/12 , 12, 12000)

10% / 12 is the interest calculations
12 is the period (how many times we will pay the bank each year) for one year
12000 the loan'a amount

- We will use the manual calculations, because Microsoft Excel built-In function uses the same manual calculations implicitly to create such handy formula for its users. As a programmer you need to analyze yourself and come up with your own formulas. Here is what I come up with.

The code below.

- Source code of the loan's monthly payments calculator.

Option Explicit'API to move windowless formPrivate Const HTCAPTION As Long = 2Private Const WM_NCLBUTTONDOWN As Long = &HA1Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _ByVal wMsg As Long, _ByVal wParam As Long, _lParam As Any) As LongPrivate Declare Function ReleaseCapture Lib "user32" () As LongDim P, PV, ARP, ARP1, R, N As DoublePrivate Sub Command1_Click()'P=(Pv*R) / [1 - (1 + R)^(-n)]PV = Val(TxtLoan.Text)N = Val(Txtmonths.Text)R = Val(TxtInterest / 100) * (1 / 12)ARP = Val(1 + R) ^ NARP1 = Val® / (ARP - 1)P = Val(R + ARP1) * PVTxtMp.Text = Format(P, "#.00")End SubPrivate Sub Command1_KeyPress(KeyAscii As Integer)If KeyAscii = vbKeyEscape Then EndEnd SubPrivate Sub Form_KeyPress(KeyAscii As Integer)If KeyAscii = vbKeyEscape Then EndEnd SubPrivate Sub Form_Load()DTC.Value = NowEnd SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)'Moving the form using mouse button from any location on the form held with mouseIf Button = 1 ThenReleaseCaptureSendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, ByVal 0&End IfEnd SubPrivate Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)If Button = 1 ThenReleaseCaptureSendMessage Me.hwnd, WM_NCLBUTTONDOWN, HTCAPTION, ByVal 0&End IfEnd SubPrivate Sub Label10_Click()Set MainFrm = NothingEndEnd SubPrivate Sub Label12_Click()Me.WindowState = vbMinimizedEnd SubPrivate Sub Timer1_Timer()Label1.Caption = Format(Now, "DDDD, D/MMMM/YYYY")Label2.Caption = Format(Now, "HH:MM:SS")End SubPrivate Sub TxtLoan_KeyPress(KeyAscii As Integer)If KeyAscii = vbKeyEscape Then EndEnd SubPrivate Sub Txtyears_Change()Txtmonths.Text = Val(Txtyears.Text) * 12End SubPrivate Sub Txtyears_KeyPress(KeyAscii As Integer)If KeyAscii = vbKeyEscape Then EndEnd Sub

لتحميل السورس كود

تم تعديل بواسطه evry1falls

شارك هذا الرد

رابط المشاركة
شارك الرد من خلال المواقع ادناه

  • يستعرض القسم حالياً   0 members

    لا يوجد أعضاء مسجلين يشاهدون هذه الصفحة .