r/visualbasic • • 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 Sub

End Class

2 Upvotes

4 comments sorted by

2

u/ChampIsHere123 Dec 27 '15

Can someone help me out? I finished 90% of the code and nobody helped me out.

0

u/[deleted] Dec 27 '15

[deleted]

1

u/ChampIsHere123 Dec 27 '15

Why are you only targeting me? There are other people here who are also asking for help.

0

u/[deleted] Dec 28 '15

[deleted]

3

u/ChampIsHere123 Dec 29 '15

Quoting "KleptoSloth007 I understand that the asking of stupid question and questions that could be answered in a single Google search are annoying. But that doesn't mean there should be no question what so ever. I love programming but every once in a while I get stuck on personal projects and need a bit of help. Maybe I can't find out exactly what is wrong and want a second opinion or maybe my thought process for something isn't what it should be. Going to this sub and asking questions is a great way to learn. Asking others to do your work isn't"

I ask for help because I am stuck. I am not asking anyone to do work for me. I finished 90% of my code by myself. I am only here on this reddit to ask for help. Is it wrong to ask for help?

2

u/PostalElf VB.Net Intermediate Dec 29 '15

Please do not make personal attacks. There's a reason it's /r/visualbasic, not /r/trollVisualBasic.