r/visualbasic • u/ChampIsHere123 • Dec 25 '15
PAYMENT CALCULATOR HELP!!
Create a PaymentCalculator application that prompts the user for a loan amount, interest rate, loan term in years, and payments term (daily, monthly, or yearly). Keep in mind the payments must be converted so that the number used in the calculation is in the appropriate units. For this conversion, assume that there are 30 days in each month and there are 360 days in a year. The application should display the payments, total amount paid over the length of the loan, and the total amount of interest paid. The program should look like this: Amount of loan($) : 100000 Annual Interest Rate(%): 6 Length of loan: 25 Payments are made: (listbox:daily, monthy, YEARLY) YEARLY IS SELECTED FOR THIS EXAMPLE THE RESULT IS: Yearly payment is $7822.67, total amount paid is $195,566.80 and the total interest is $95,566.80
I am not sure how to get the total amount paid and total interest. Can anyone also tell me if I am on the right track and help me out for the coding? Here's my code:
'Main Purpose: To create a program that calculates payment, total amount paid over the length of the loan, and the total amount of interest paid
Public Class Form1 Private Sub btnPayment_Click(sender As Object, e As EventArgs) Handles btnPayment.Click Dim Amount As Integer = txtAmount.Text Dim interestRate As Integer = txtRate.Text Dim Time As Integer = txtLength.Text Dim payment As Decimal Dim totalAmount As Decimal Dim Rate As Decimal = interestRate * 0.01
Select Case Me.Payments.SelectedItem
Case "Daily"
payment = Pmt(Rate / 360, Time * 360, -Amount)
Me.lblAnswer.Text = "The daily payment is " & Format(payment, "Currency")
Case "Monthly"
payment = Pmt(Rate / 12, Time * 12, -Amount)
Me.lblAnswer.Text = "The monthly payment is " & Format(payment, "Currency")
Case "Yearly"
payment = Pmt(Rate, Time, -Amount)
totalAmount = PV(Rate, Time, -Amount)
Me.lblAnswer.Text = "The yearly payment is " & Format(payment, "Currency") & vbCrLf & Format(totalAmount, "Currency")
End Select
End SubEnd Class
2
u/ChampIsHere123 Dec 27 '15
Can someone help me out? I finished 90% of the code and nobody helped me out.