Sunday, November 8, 2015

I am having trouble with this code on Visual Basics The assignment is?


The Assignment is Write a program to analyze a mortgage. I should enter the load, annual percentage rate of interest, and the duration of the loan in months.

payment = p*r/(1 -(1 +r)^(-n. Where p is the amount of the loan, r is the monthly interest rate (Annual rate divided by 12) given as a number between 0 (for 0 percent) and 1 (for 100 percent), and n is the duration of the loan in months.

Here is my code

ublic Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim rate As Double
Dim prin As Double
Dim term As Double
Dim thePay As Double
Dim totalInterest As Double

If TextBoxPrin.Text = "" Then MsgBox("Enter Principle")
If TextBoxRate.Text = "" Then MsgBox("Enter Interest")
If TextBoxTerm.Text = "" Then MsgBox("Enter Term")

If Not Double.TryParse(TextBoxPrin.Text, prin) Then
Exit Sub
End If

If Not Double.TryParse(TextBoxInterest.Text, rate) Then
Exit Sub
End If

If Not Double.TryParse(TextBoxTerm.Text, term) Then
Exit Sub
End If

If rate >= 1 Then rate = rate / 100
rate = rate / 12
thePay. Rate * prin) / (1. 1 + rate) ^ -term.
totalInterest. Term * thePay) - (-prin.

TextBoxPayment.Text = thePay

TextBoxInterest.Text = totalInterest
End Sub
End Class

I have no idea why nothing happens when I enter values

Read more: I am having trouble with this code on Visual Basics The assignment is?