chapter 5 exercises turn in sheet

# Clear lbltotalpricetext end sub private sub

• 5

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

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

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern