Skip to content

Instantly share code, notes, and snippets.

@azcoov
Created March 10, 2011 03:39
Show Gist options
  • Save azcoov/863534 to your computer and use it in GitHub Desktop.
Save azcoov/863534 to your computer and use it in GitHub Desktop.
Mortgage Calc example
Class Mortgage
Private Property LoanAmount() As [Decimal]
Get
Return m_LoanAmount
End Get
Set
m_LoanAmount = Value
End Set
End Property
Private m_LoanAmount As [Decimal]
Private Property InterestRate() As [Decimal]
Get
Return m_InterestRate
End Get
Set
m_InterestRate = Value
End Set
End Property
Private m_InterestRate As [Decimal]
Private Property Term() As Int32
Get
Return m_Term
End Get
Set
m_Term = Value
End Set
End Property
Private m_Term As Int32
End Class
Class LoanCalculator
'main entry point of the program
Private Shared Sub Main(args As [String]())
'create the mortgage object
Dim mortgage As New Mortgage() With { _
.LoanAmount = New [Decimal](100000.0), _
.InterestRate = New [Decimal](0.575), _
.Term = 30 _
}
'pass the mortgage object to the calculate payment method to get the payment amount
Dim paymentAmount = CalculatePayment(mortgage)
End Sub
'Accepts a mortgage object and calculate the payment based on the Mortgage properties
Private Shared Function CalculatePayment(mortgage As Mortgage) As [Decimal]
'algorthim to calculate the payment
End Function
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment