Computer Science Canada

I have to take my Loan 2 program and convert it to a table I put a link to the image need help with the format design

Author:  mmyles1949 [ Wed Oct 19, 2011 10:05 pm ]
Post subject:  I have to take my Loan 2 program and convert it to a table I put a link to the image need help with the format design

Loan Payment 3

For this assignment you will be creating a new variation of the loan payment program. This time you will ask the user for only one piece of information: the principal amount of the loan. The interest and years will come from the columns and rows from your table.

Use a "Do While" loop to read the principal amount from the user. Make sure that the user enters a positive numeric value before proceeding with the rest of your program.

Like loan payment 2, you need to have your values for interest from 5% through 15% in .25% increments down the left-most column of your table. You will also need to include values for Years from 5 to 30 years in 5-year increments in the first row of the table. Please label the header row and column as being Years and Interest values, respectively.

Here is a sample of what your program might look like (yours doesn't need to be formatted exactly like this, but it should be something similar). Note that this image does not show the user entering a value for the principal as it had already scrolled off the top of the screen:


'Melvin T Myles Loan_Payment2
Option Strict On
Module Loan_Payment2

Sub Main()
Dim Principal As Double
Dim Years As Integer
Dim pipeLocation As Integer
Dim interestsRate As Double
Dim Temp As Double
Dim MonthlyPayment As Double
Dim Months As Double

Console.Write("Please enter a Principal amount: ")
Principal = (CDbl(Console.ReadLine()))

Console.Write("Please enter the legnth of loan in years: ")

Years = CInt(Console.ReadLine())

Console.Write("Interest Rate ")
pipeLocation = Console.CursorLeft
Console.WriteLine("| MonthlyPayment")


'Loop Condition
interestsRate = 5.0
Months = CInt(Years * 12)

While (interestsRate <= 15.0)

Temp = (1 / (1 + ((interestsRate / 100) / 12)))
MonthlyPayment = ((1 - Temp) * Principal) / (Temp * (1 - (Temp ^ Months)))
MonthlyPayment = Math.Round(MonthlyPayment, 2)

Console.Write(" " + CStr(interestsRate) + " %")
Console.CursorLeft = pipeLocation
Console.WriteLine("| $ " + CStr(MonthlyPayment))

'increment control
interestsRate = interestsRate + 0.25

End While

End Sub

End Module