VERSION 5.00
Begin VB.Form InterestCalculater 
   Caption         =   "Interest Calculater "
   ClientHeight    =   4620
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8610
   LinkTopic       =   "Form1"
   ScaleHeight     =   4620
   ScaleWidth      =   8610
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox txtTotalInterest 
      Height          =   375
      Left            =   6600
      TabIndex        =   5
      Top             =   1080
      Width           =   1455
   End
   Begin VB.TextBox txtMonthlyPayment 
      Height          =   375
      Left            =   6600
      TabIndex        =   4
      Top             =   240
      Width           =   1455
   End
   Begin VB.TextBox txtYears 
      Height          =   375
      Left            =   1560
      TabIndex        =   2
      Top             =   1320
      Width           =   1335
   End
   Begin VB.TextBox txtInterest 
      Height          =   375
      Left            =   1560
      TabIndex        =   0
      Top             =   120
      Width           =   1335
   End
   Begin VB.TextBox txtAmount 
      Height          =   375
      Left            =   1560
      TabIndex        =   1
      Top             =   720
      Width           =   1335
   End
   Begin VB.CheckBox chkMonthly 
      Caption         =   "Click Here to See Monthly Payments"
      Height          =   375
      Left            =   3240
      TabIndex        =   6
      Top             =   1080
      Width           =   1935
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "Exit"
      Height          =   375
      Left            =   6600
      TabIndex        =   8
      Top             =   3960
      Width           =   1095
   End
   Begin VB.ListBox lstMonthlyDisplay 
      Height          =   2205
      Left            =   3240
      TabIndex        =   10
      Top             =   1560
      Width           =   4815
   End
   Begin VB.CommandButton cmdReset 
      Caption         =   "Reset"
      Height          =   375
      Left            =   2760
      TabIndex        =   7
      Top             =   3960
      Width           =   1095
   End
   Begin VB.CommandButton cmdCalculate 
      Caption         =   "Calculate"
      Height          =   375
      Left            =   240
      TabIndex        =   3
      Top             =   3960
      Width           =   1095
   End
   Begin VB.ListBox lstDisplay 
      Height          =   1620
      Left            =   240
      TabIndex        =   9
      Top             =   2160
      Width           =   2655
   End
   Begin VB.Label lblTotalInterest 
      Caption         =   "Total Interest Paid:"
      Height          =   375
      Left            =   5160
      TabIndex        =   16
      Top             =   1080
      Width           =   1695
   End
   Begin VB.Label lblMonthlyPayment 
      Caption         =   "Monthly Payment:"
      Height          =   375
      Left            =   5160
      TabIndex        =   15
      Top             =   240
      Width           =   1335
   End
   Begin VB.Label lblAmountOwed 
      Caption         =   "Amount Owed after X Years"
      Height          =   255
      Left            =   240
      TabIndex        =   14
      Top             =   1800
      Width           =   2655
   End
   Begin VB.Label lblYears 
      Caption         =   "Number of Years"
      Height          =   255
      Left            =   240
      TabIndex        =   13
      Top             =   1440
      Width           =   1215
   End
   Begin VB.Label lblAmount 
      Caption         =   "Enter Principle:"
      Height          =   255
      Left            =   240
      TabIndex        =   12
      Top             =   840
      Width           =   1215
   End
   Begin VB.Label lblInterest 
      Caption         =   "Interest Rate (%)"
      Height          =   255
      Left            =   240
      TabIndex        =   11
      Top             =   240
      Width           =   1215
   End
End
Attribute VB_Name = "InterestCalculater"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
    Dim dblInterestRate As Double
    Dim dblMthInterestRate As Double
    Dim sngMonthlyRate As Single
    Dim strDispLine As String
    Dim intYears As Integer
    Dim intMonths As Integer
    Dim intCounter As Integer
    Dim intPayments As Integer
    Dim intPaymentNumber As Integer
    Dim intYearNumber As Integer
    Dim curCurrentAmt As Currency
    Dim curTotalInt As Currency
    Dim curTotalPayment As Currency
    Dim curMonthlyInt As Currency
    Dim curAmount As Currency
    Dim curPrincipal As Currency
    Dim curMonthlyPayment As Currency
    Dim curPrincipalPaid As Currency
    
    
    
    






Private Sub chkMonthly_Click()

    'Sends Monthly Payments to lstMonthlyPayments
    
        intCounter = 1
        curPrincipal = Val(txtAmount)
        
        lstMonthlyDisplay.AddItem ("Month" & vbTab & "Amount Payed")
        dblMthInterestRate = Val(txtInterest / (12 * 100))
        intMonths = (intYears * 12)
        curMonthlyPayment = curPrincipal * (dblMthInterestRate / (1 - (1 + dblMthInterestRate) ^ -intMonths))
        
        txtMonthlyPayment = Format(curMonthlyPayment, "$######.00")
        txtTotalInterest = (dblMthInterestRate * intMonths)
        dblMthInterestRate = Format(dblMthInterestRate, "$######.00")
    
    For intCounter = 1 To (intYears * 12)
        
        curTotalPayment = (curTotalPayment + curMonthlyPayment)
        curTotalPayment = curTotalPayment + dblMthInterestRate
        lstMonthlyDisplay.AddItem (intCounter & vbTab & Format(curTotalPayment, "$######.00"))
    
    Next intCounter
    
       
        
    
End Sub

Private Sub cmdCalculate_Click()

        'Sends Total Payments over X Years to lstDisplay
        
        intCounter = 1
        curPrincipal = Val(txtAmount)
        intYears = Val(txtYears)
        dblInterestRate = Val(txtInterest)
    
        lstDisplay.AddItem ("Year" & vbTab & "Amount Owed")
    
    For intCounter = 1 To intYears
        
        
        curCurrentAmt = curPrincipal * (1 + dblInterestRate / 100) ^ intCounter
        lstDisplay.AddItem (intCounter & vbTab & Format(curCurrentAmt, "$######.00"))
        
    
    Next intCounter
    
        
        
        
        
        
        
        
    
    
        
        
        
End Sub

Private Sub cmdExit_Click()

    End
End Sub

Private Sub cmdReset_Click()

    
    
    chkMonthly.Value = 0
    
     dblInterestRate = 0
     dblMthInterestRate = 0
     sngMonthlyRate = 0
     strDispLine = 0
     intYears = 0
     intMonths = 0
     intCounter = 0
     intPayments = 0
     intPaymentNumber = 0
     intYearNumber = 0
     curCurrentAmt = 0
     curTotalInt = 0
     curTotalPayment = 0
     curMonthlyInt = 0
     curAmount = 0
     curPrincipal = 0
     curMonthlyPayment = 0
     curPrincipalPaid = 0
    
    lstDisplay.Clear
    lstMonthlyDisplay.Clear
    
    txtAmount.Text = " "
    txtInterest.Text = " "
    txtYears.Text = " "
    txtMonthlyPayment.Text = " "
    txtTotalInterest.Text = " "
    
    txtInterest.SetFocus
    
    
    
    
    
    
End Sub

