0% found this document useful (0 votes)
60 views

Exercise 4

This code checks package dimensions and weight against certain criteria to determine if a package will be accepted or rejected for shipping. It takes the weight in pounds from one text box, and calculates the size in cubic inches from three text boxes for length, width, and height. If the weight is over 27 pounds or the size is over 100,000 cubic inches, it will display "Rejected: Too heavy and large". Otherwise, if just the weight or just the size threshold is exceeded, it will display the applicable rejected message, and if both are within limits it will display "Accepted".

Uploaded by

api-307933689
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Exercise 4

This code checks package dimensions and weight against certain criteria to determine if a package will be accepted or rejected for shipping. It takes the weight in pounds from one text box, and calculates the size in cubic inches from three text boxes for length, width, and height. If the weight is over 27 pounds or the size is over 100,000 cubic inches, it will display "Rejected: Too heavy and large". Otherwise, if just the weight or just the size threshold is exceeded, it will display the applicable rejected message, and if both are within limits it will display "Accepted".

Uploaded by

api-307933689
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Exercise 4

Public Class Form1


Private Sub btnCheckPackage_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCheckPackage.Click
Dim weight As Integer = Val(txtWeight.Text)
Dim size As Integer = Val(txtHeight.Text) * Val(txtLength.Text) * Val(txtWidth.Text)
If weight > 27 And size > 100000 Then
Me.lblOutcome.Text = "Rejected: Too heavy and large"
ElseIf weight > 27 Then
Me.lblOutcome.Text = "Rejected: Too heavy"
ElseIf size > 100000 Then
Me.lblOutcome.Text = "Rejected: Too large"
Else
Me.lblOutcome.Text = "Accepted"
End If
End Sub
End Class

You might also like