Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. Chapter 14 Exercise #10 & #11
  2.  
  3.  
  4. Public Class frmMain
  5.  
  6. Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
  7. Me.Close()
  8. End Sub
  9. Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
  10. ' calculates and displays monthly payment amounts
  11. Dim decRun As Decimal
  12. Dim decWalk As Decimal
  13.  
  14. txtRun.Text = String.Empty
  15.  
  16. For decTime As Decimal = 15 To 60 Step 15
  17. decRun = decTime * 5
  18. txtRun.Text = txtRun.Text & decTime.ToString("N0") &
  19. " Minutes -> " & decRun.ToString("N2") & " Calories" & ControlChars.NewLine
  20. Next decTime
  21.  
  22. txtWalk.Text = String.Empty
  23.  
  24. For decTime As Decimal = 15 To 60 Step 15
  25. decWalk = decTime * 2.5
  26. txtWalk.Text = txtWalk.Text & decTime.ToString("N0") &
  27. " Minutes -> " & decWalk.ToString("N2") & " Calories" & ControlChars.NewLine
  28. Next decTime
  29.  
  30. End Sub
  31. End Class
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. Public Class frmMain
  40.  
  41. Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
  42. Me.Close()
  43. End Sub
  44.  
  45. Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
  46. Dim decRate As Decimal = 0.03
  47. Dim decTotal As Decimal
  48. Dim decPayment As Decimal
  49.  
  50. Decimal.TryParse(txtTotal.Text, decTotal)
  51.  
  52. decPayment = Financial.Pmt(decRate / 12, 240, 0, -decTotal)
  53.  
  54. lblSave.Text = decPayment.ToString("C2")
  55. End Sub
  56. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement