Below is what the interface is displaying.
This is what is supposed to do: (From Book)
you create an application that displays a monthly payment on a loan of $3000 for 1 year at 7% interest. The application also should display the amount applied to the loan’s principal each month, and the amount that represents interest. The application will use the Financial.Pmt method, which you learned about in the chapter, to
calculate the monthly payment. It also will use the Financial.PPmt method to calculate the portion of the payment applied to the principal each month. The method’s syntax is Financial.PPmt(Rate, Per, NPer, PV), where Rate is the interest rate, NPer is the number
of payment periods, and PV is the present value of the loan. The Per argument is the payment period in which you are interested and must be from 1 through NPer.
a. List the output and input items, as well as any processing items, and then create an appropriate algorithm using pseudocode.
b. Create a Visual Basic Windows application. Use the following names for the solution and project, respectively: Principal and Interest Solution, and Principal and Interest
Project. Save the application in the ClearlyVB2010\Chap14 folder. Change the name of the form file on your disk to frmMain.vb. If necessary, change the form’s name to
c. Create the interface shown in Figure 14-16. Set the text box’s Multiline and ReadOnly
properties to True.
d. Code the application using a For…Next statement to keep track of the
Financial.PPmt method’s Per argument. The Per values will be from 1 through 12.
e. Save the solution and then start and test the application. (Hint: The monthly payment
should be $259.58. In the first month, 242.08 is applied to the principal, and 17.50 is
interest.) Close the Code Editor window and then close the solution.
This is my code:
Public Class Form1
Private Sub btnDisplayPrincipal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplayPrincipal.Click
Dim MonthlyPayments As Double
Dim bloanTotal As Double = 3000
Dim rate As Double = 0.007
Dim interest As Double
Dim toPrincipal As Double
Dim toInterest As Double
Dim counter As Integer
For counter = 1 To 12
'Calculate the monthly payments
Math.Abs(Financial.Pmt(0.07 / 12, 12, 3000))
TextBox1.Text = MonthlyPayments.ToString("C2")
counter = counter + 1 'add one to the counter
interest = bloanTotal + rate 'calculate interest rate from payment that will only count as interest
toInterest = MonthlyPayments - interest ' amount of monthly payment going towards interest
toPrincipal = MonthlyPayments - toInterest ' amount of monthly payment going towards principal
bloanTotal = bloanTotal - toPrincipal ' new balance after deducting principal from beginning balance
lblMonthlyPayment.Text &= toPrincipal.ToString & " " & toInterest.ToString & ControlChars.NewLine
Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
I couldn't use wikisend, didn't work with me. I used filemail instead. Here's the link:
This is also for monday may 13. Thanks!