All pastes #403641 Raw Edit

Mine

public text v1 · immutable
·published 2007-03-20 15:07 UTC
rendered paste body
Dim goal As Double
        Dim interestRate As Double
        Dim loanTerm As Double
        Dim weeklyPayment As Double


        'input
        goal = Double.Parse(Me.uiGoalTextBox.Text)
        interestRate = Double.Parse(Me.uiRateTextBox.Text)
        loanTerm = Double.Parse(Me.uiTermTextBox.Text)


        If interestRate >= 1.0 Then
            interestRate = interestRate / 100.0
        End If

        weeklyPayment = interestRate / 52

        If loanTerm >= 1.0 Then
            weeklyPayment = -Financial.PPmt(interestRate / 52, 1, loanTerm * 52, 0, goal, DueDate.EndOfPeriod)
            Me.uiSavingsLabel.Text = Format(weeklyPayment, "Currency")
        End If