The document contains all criteria for assignment 5:
Unit 14 Criteria:
P2, P3, P4, P5, P6, M2, M3, M4, D2.
Unit 6 Criteria
P6, M2, D2.
I received full marks for this assignment.
The start button starts the
code and the package starts
to move after this button is
clicked. These labels show the user
how many total packages
there are of that specific
type.
The reset button allows the user
to click it to start the process
over so that the package moves
These labels show the
to the beginning of the conveyor
percentage of unsealed and
belt. These red boxes are the
the number of unsealed
packages. sensors, these were used
within the code to detect
the different package types.
, 1 Public Class Form1
2 Dim Type As Integer
3 Dim Sealed As Boolean
4 Dim NumbSmall As Byte 'This adds the NumbSmall as a varible and stores it as a
byte
5 Dim NumbMedium As Byte 'This adds the NumbMedium as a variable and stores as byte
6 Dim NumbLarge As Byte 'This adds NumbLarge as a variable and stores it as a byte
7 Dim NumbTotal As Byte '
8 Dim NumbUnsealed As Byte
9 Dim NumbUnSeal As Byte
10
11 Private Sub BtnStart_Click(sender As Object, e As EventArgs) Handles
BtnStart.Click
12 Type = 0
13 Randomize()
14 Type = Type + Int(Rnd() * 4) + 1 'this defines the amount of images it shows
15 Sealed = Sealed + Int(Rnd() * 2) + 1 'this is a true or false for the
unsealed packages
16
17 TmrMove.Enabled = True
18
19 Select Case Type
20 Case 1 'This is a Small Package Case
21 PicPackage.Image = My.Resources.Small_Box1
22
23 Case 2 'Medium Package Case
24 PicPackage.Image = My.Resources.Medium_Box
25
26 Case 3 'Case for the Large Package
27 PicPackage.Image = My.Resources.Large_Box
28
29 Case Else
30 PicPackage.Image = My.Resources.Unsealed
31
32 End Select
33
34
35 End Sub
36
37 Private Sub CheckCollision()
38
39 If PicPackage.Bounds.IntersectsWith(PicSensorS.Bounds) = True And Type = 1
Then
40 TmrMove.Enabled = False
41 MessageBox.Show("Small Package Detected")
42 NumbSmall = NumbSmall + 1 'this adds up the Small Packages so that the
total shows next to the label
43 LblNumbSmall.Text = NumbSmall
44 NumbTotal = NumbTotal + 1
45 LblTotal.Text = NumbTotal.ToString
46
47 ElseIf PicPackage.Bounds.IntersectsWith(PicSensorM.Bounds) = True And Type =
2 Then
48 TmrMove.Enabled = False
49 MessageBox.Show("Medium Package Detected")
50 NumbMedium = NumbMedium + 1 'this adds up the Medium Packages so that
the total shows next to the label
51 LblNumbMedium.Text = NumbMedium
52 NumbTotal = NumbTotal + 1
53 LblTotal.Text = NumbTotal.ToString
54
55 ElseIf PicPackage.Bounds.IntersectsWith(PicSensorL.Bounds) = True And Type =
3 Then
56 TmrMove.Enabled = False
57 MessageBox.Show("Large Package Detected")
58 NumbLarge = NumbLarge + 1 'this adds up the Large Packages so that the
total shows next to the label
59 LblNumbLarge.Text = NumbLarge
60 NumbTotal = NumbTotal + 1
61 LblTotal.Text = NumbTotal.ToString
62
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller ItsKenzie. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $10.31. You're not tied to anything after your purchase.