VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form1"
   ClientHeight    =   6465
   ClientLeft      =   45
   ClientTop       =   375
   ClientWidth     =   3990
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6465
   ScaleWidth      =   3990
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdExit 
      Caption         =   "Exit"
      Height          =   375
      Left            =   2760
      TabIndex        =   11
      Top             =   3720
      Width           =   975
   End
   Begin VB.CommandButton cmdClear 
      Caption         =   "Clear"
      Height          =   375
      Left            =   360
      TabIndex        =   10
      Top             =   3720
      Width           =   1095
   End
   Begin VB.TextBox txtDp 
      Height          =   285
      Left            =   1680
      TabIndex        =   5
      Top             =   960
      Width           =   1815
   End
   Begin VB.CommandButton cmdCalculate 
      Caption         =   "&Calculate"
      Height          =   375
      Left            =   1560
      TabIndex        =   3
      Top             =   3720
      Width           =   1095
   End
   Begin VB.TextBox txtMonth 
      Height          =   285
      Left            =   1680
      TabIndex        =   2
      Top             =   1680
      Width           =   1815
   End
   Begin VB.TextBox txtInterest 
      Height          =   285
      Left            =   1680
      TabIndex        =   1
      Top             =   1320
      Width           =   1815
   End
   Begin VB.TextBox txtLoanAmount 
      Height          =   285
      Left            =   1680
      TabIndex        =   0
      Top             =   570
      Width           =   1815
   End
   Begin VB.Label Label4 
      Caption         =   "Duration "
      Height          =   255
      Left            =   360
      TabIndex        =   9
      Top             =   1680
      Width           =   1215
   End
   Begin VB.Label Label3 
      Caption         =   "Interest rate (%)"
      Height          =   255
      Left            =   360
      TabIndex        =   8
      Top             =   1320
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "Down Payment"
      Height          =   255
      Left            =   360
      TabIndex        =   7
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "Total Car Price"
      Height          =   255
      Left            =   360
      TabIndex        =   6
      Top             =   600
      Width           =   1215
   End
   Begin VB.Label txtInstallment 
      Height          =   975
      Left            =   1680
      TabIndex        =   4
      Top             =   2280
      Width           =   1815
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdCalculate_Click()
'Declare variable
Dim curLoan As Currency
Dim douInterest As Double
Dim intMonth As Integer
Dim curInstallment As Currency
Dim curDp As Currency

'Convert input variable = Val
curLoan = Val(txtLoanAmount.Text)
douInterest = Val(txtInterest.Text)
intMonth = Val(txtMonth.Text)
curInstallment = Val(txtInstallment.Caption)
curDp = Val(txtDp.Text)


If txtLoanAmount.Text = "" Then
MsgBox "Enter a number for Total Car Price"
txtLoanAmount.SetFocus
End If

If txtInterest.Text = "" Then
MsgBox "Enter a number for Interest Rate"
txtInterest.SetFocus
End If


'Calculation
douInterest = douInterest / 100
a = curLoan - curDp
b = 1 + douInterest
c = b ^ intMonth
d = douInterest * c
e = intMonth - 1
f = b ^ e
g = a * d
curInstallment = g / f



'Display Output
txtInstallment.Caption = curInstallment

End Sub

Private Sub cmdClear_Click()
txtLoanAmount = ""
txtDp = ""
txtInterest = ""
txtMonth = ""
txtInstallment = ""
End Sub

Private Sub cmdExit_Click()
End
End Sub

