Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Chapter 14 Exercise #10 & #11
- Public Class frmMain
- Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
- Me.Close()
- End Sub
- Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
- ' calculates and displays monthly payment amounts
- Dim decRun As Decimal
- Dim decWalk As Decimal
- txtRun.Text = String.Empty
- For decTime As Decimal = 15 To 60 Step 15
- decRun = decTime * 5
- txtRun.Text = txtRun.Text & decTime.ToString("N0") &
- " Minutes -> " & decRun.ToString("N2") & " Calories" & ControlChars.NewLine
- Next decTime
- txtWalk.Text = String.Empty
- For decTime As Decimal = 15 To 60 Step 15
- decWalk = decTime * 2.5
- txtWalk.Text = txtWalk.Text & decTime.ToString("N0") &
- " Minutes -> " & decWalk.ToString("N2") & " Calories" & ControlChars.NewLine
- Next decTime
- End Sub
- End Class
- Public Class frmMain
- Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
- Me.Close()
- End Sub
- Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
- Dim decRate As Decimal = 0.03
- Dim decTotal As Decimal
- Dim decPayment As Decimal
- Decimal.TryParse(txtTotal.Text, decTotal)
- decPayment = Financial.Pmt(decRate / 12, 240, 0, -decTotal)
- lblSave.Text = decPayment.ToString("C2")
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement