chapter 5 exercises turn in sheet

Clear lbltotalpricetext end sub private sub

This preview shows page 2 - 4 out of 5 pages.

txtTicketAmount.Clear() lblTotalPrice.Text = "" txtTicketAmount.Focus() End Sub Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click Dim intTicketAmount As Integer = 0 Dim decTickets As Decimal = 72D Dim decTotalCost As Decimal Dim decAAA As Decimal = 0.15D Dim decAARP As Decimal = 0.17D Dim decMilitary As Decimal = 0.2D Dim decDiscount If IsNumeric(txtTicketAmount.Text) Then intTicketAmount = Convert.ToInt32(txtTicketAmount.Text) If intTicketAmount > 0 Then If radAAA.Checked Then decDiscount = decAAA ElseIf radAARP.Checked Then decDiscount = decAARP ElseIf radMilitary.Checked Then decDiscount = decMilitary End If decTotalCost = (intTicketAmount * decTickets) * (1 - decDiscount) lblTotalPrice.Text = decTotalCost.ToString("C") Else MsgBox("Enter a positive number", , "Negative Number Error") End If Else MsgBox("Enter a positive number", , "Invalid Entry Error") End If End Sub End Class
Image of page 2

Subscribe to view the full document.

Chapter 5 Exercises 3. #3 Patient Weight Converter 'Weight Converter 'Joshua Ricks '11/4/16 Public Class frmWeightConverter Private Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles btnDisplay.Click Dim decWeightEntered As Decimal Dim decConvertedWeight As Decimal Dim decConversionRate As Decimal = 2.2D If IsNumeric(txtEnteredWeight.Text) Then decWeightEntered = Convert.ToDecimal(Me.txtEnteredWeight.Text) If decWeightEntered > 0 Then If radKGtoIB.Checked Then If decWeightEntered <= 225 Then decConvertedWeight = decWeightEntered * decConversionRate lblConverted.Text = "Pounds" lblConvertedWeight.Text = decConvertedWeight.ToString("F1") Else MsgBox("Kilograms must be 225 or less", , "Input Error") txtEnteredWeight.Text = "" txtEnteredWeight.Focus() End If Else If decWeightEntered <= 500 Then
Image of page 3
Image of page 4

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern