[RESOLVED] Can't Import Classes
For some reason I can't import the classes that I created. I'm not sure why. Can anybody help me out? I added a namespace, but it still isn't working. Any help is much appreciated.
I need to add these classes to an ASP.NET website for school. However, my imports statement doesn't even show the option. What am I missing?
First Class:
Code:
Namespace Butler
Public Class MortLoan
' Declare some private variables to work with
Private _MortgageAmount As Double
Private _InterestRate As Double
Private _LoanTerm As Integer
Private _PaymentAmount As Double
' Get or set the mortgage amount
'
Public Property MortgageAmount()
Get
Return _MortgageAmount
End Get
Set(ByVal value)
value = _MortgageAmount
End Set
End Property
' Get or set the interest rate
'
Public Property InterestRate()
Get
Return _InterestRate
End Get
Set(ByVal value)
value = _InterestRate
End Set
End Property
' Get or set the loan term in years
'
Public Property LoanTermInYears()
Get
Return _LoanTerm
End Get
Set(ByVal value)
value = _LoanTerm
End Set
End Property
' Get or set the payment amount
'
Public Property PaymentAmount()
Get
Return _PaymentAmount
End Get
Set(ByVal value)
value = PaymentAmount
End Set
End Property
' The following items are required in order to create a new loan object
'
Public Sub New(ByVal MortgageAmount As Double, ByVal InterestRate As Double, ByVal LoanTermInYears As Integer)
_MortgageAmount = MortgageAmount
_InterestRate = InterestRate
_LoanTerm = LoanTermInYears
End Sub
' An extended method for calling a new loan
'
Protected Sub New(ByVal MortgageAmount As Double, ByVal InterestRate As Double, ByVal LoanTermInYears As Integer, ByVal PaymentAmount As Double)
_MortgageAmount = MortgageAmount
_InterestRate = InterestRate
_LoanTerm = LoanTermInYears
_PaymentAmount = PaymentAmount
End Sub
' This sub calculates the approximate lifetime interest using a simple calculation
'
Friend Function calculateApproxLifetimeInterest(ByVal TotalMortgageAmount As Double, ByVal YearlyInterestRate As Double, ByVal ThisLoanTermInYears As Integer)
Dim SimpleInterestCalculation As Double
SimpleInterestCalculation = TotalMortgageAmount * (YearlyInterestRate / 100) * ThisLoanTermInYears
Return SimpleInterestCalculation
End Function
' This sub calculates the approximate lifetime interest using a simple calculation for a loan object
'
Shared Function calculateApproxLifetimeLoanObjectInterest(ByVal LoanObject As MortLoan)
Dim SimpleInterestCalculation As Double
SimpleInterestCalculation = LoanObject.MortgageAmount * (LoanObject.InterestRate / 100) * LoanObject.LoanTermInYears
Return SimpleInterestCalculation
End Function
' Calculates the monthly payment
'
Friend Function calculateLoanPayment(ByVal TotalMortgageAmount As Double, ByVal YearlyInterestRate As Double, ByVal ThisLoanTermInYears As Integer)
' Create some variables and assign the values to the
' various text boxes or calculations based on the textbox
' values
'
_MortgageAmount = TotalMortgageAmount
_InterestRate = YearlyInterestRate
_LoanTerm = ThisLoanTermInYears
TotalMortgageAmount = MortgageAmount
YearlyInterestRate = InterestRate
ThisLoanTermInYears = LoanTermInYears
Dim totalNumberOfPayments = ThisLoanTermInYears * 12
Dim monthlyInterestRate = (YearlyInterestRate / 100) / 12
Dim monthlyPayment As Double
' Formula Source: http://www.hughchou.org/calc/formula.html
' M = P * ( J / (1 - (1 + J) ** -N))
' Calculate the monthly payment
monthlyPayment = _MortgageAmount * (monthlyInterestRate / (1 - (1 + monthlyInterestRate) ^ -totalNumberOfPayments))
Return monthlyPayment
End Function
' Calculates the monthly payment of a loan object
'
Friend Shared Function calculateLoanObjectPayment(ByVal LoanObject As MortLoan)
' Create some variables and assign the values to the
' various text boxes or calculations based on the textbox
' values
'
Dim MortgageAmount = LoanObject.MortgageAmount
Dim InterestRate = LoanObject.InterestRate
Dim LoanTerm = LoanObject.LoanTermInYears
Dim totalNumberOfPayments = LoanTerm * 12
Dim monthlyInterestRate = (InterestRate / 100) / 12
Dim monthlyPayment As Double
' Formula Source: http://www.hughchou.org/calc/formula.html
' M = P * ( J / (1 - (1 + J) ** -N))
' Calculate the monthly payment
monthlyPayment = MortgageAmount * (monthlyInterestRate / (1 - (1 + monthlyInterestRate) ^ -totalNumberOfPayments))
Return monthlyPayment
End Function
' Checks the Mortgage Amount to ensure the values are correct
'
Public Shared Sub checkMortgageAmount(ByVal MortgageAmount As Double)
Try
If MortgageAmount < 50000 Then
MsgBox("The Mortgage Amount is below $50,000. Please double check your values " & _
"before continuing.", MsgBoxStyle.Information, "Check Mortgage Amount")
ElseIf MortgageAmount > 1000000 Then
MsgBox("The Mortgage Amount is above $1,000,000. Please double check your values " & _
"before continuing.", MsgBoxStyle.Information, "Check Mortgage Amount")
End If
Double.Parse(MortgageAmount)
Catch ex As Exception
MsgBox("Please check the value for the mortgage amount!" & vbNewLine & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Mortgage Value Input Error")
End Try
End Sub
' Checks the Interest Rate to ensure the values are correct
'
Public Shared Sub checkInterestRate(ByVal InterestRate As Double)
Try
If InterestRate < 5 Then
MsgBox("The Interest Rate is below 5.00%. Please double check your values " & _
"before continuing.", MsgBoxStyle.Information, "Check Interest Amount")
ElseIf InterestRate > 10 Then
MsgBox("The Interest Rate is above 10.00%. Please double check your values " & _
"before continuing.", MsgBoxStyle.Information, "Check Interest Rate")
End If
Double.Parse(InterestRate)
Catch ex As Exception
MsgBox("Please check the value for the interest rate!" & vbNewLine & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Interest Rate Input Error")
End Try
End Sub
' Checks the Loan Term to ensure the values are correct
'
Public Shared Sub checkLoanTerm(ByVal LoanTermInYears As Integer)
Try
If LoanTermInYears < 7 Then
MsgBox("The loan term is below 7 years. Please double check your values " & _
"before continuing.", MsgBoxStyle.Information, "Check Loan Term Value")
ElseIf LoanTermInYears > 30 Then
MsgBox("The loan term is above 30 years. Please double check your values " & _
"before continuing.", MsgBoxStyle.Information, "Check Loan Term Value")
End If
Double.Parse(LoanTermInYears)
Catch ex As Exception
MsgBox("Please check the value for the loan term!" & vbNewLine & vbNewLine & ex.Message, MsgBoxStyle.Critical, "Loan Term Input Error")
End Try
End Sub
End Class
End Namespace