Public Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents TextBox3 As System.Windows.Forms.TextBox Friend WithEvents RadioButton1 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton2 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton3 As System.Windows.Forms.RadioButton Friend WithEvents GroupBox3 As System.Windows.Forms.GroupBox Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox Friend WithEvents ComboBox2 As System.Windows.Forms.ComboBox Friend WithEvents GroupBox4 As System.Windows.Forms.GroupBox Friend WithEvents ListBox1 As System.Windows.Forms.ListBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents Button4 As System.Windows.Forms.Button Friend WithEvents Button5 As System.Windows.Forms.Button Friend WithEvents CheckBox1 As System.Windows.Forms.CheckBox Friend WithEvents GroupBox5 As System.Windows.Forms.GroupBox Friend WithEvents RadioButton4 As System.Windows.Forms.RadioButton Friend WithEvents RadioButton5 As System.Windows.Forms.RadioButton Private Sub InitializeComponent() Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.TextBox3 = New System.Windows.Forms.TextBox Me.TextBox2 = New System.Windows.Forms.TextBox Me.TextBox1 = New System.Windows.Forms.TextBox Me.Label3 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.Label1 = New System.Windows.Forms.Label Me.GroupBox2 = New System.Windows.Forms.GroupBox Me.RadioButton3 = New System.Windows.Forms.RadioButton Me.RadioButton2 = New System.Windows.Forms.RadioButton Me.RadioButton1 = New System.Windows.Forms.RadioButton Me.GroupBox3 = New System.Windows.Forms.GroupBox Me.ComboBox2 = New System.Windows.Forms.ComboBox Me.ComboBox1 = New System.Windows.Forms.ComboBox Me.GroupBox4 = New System.Windows.Forms.GroupBox Me.ListBox1 = New System.Windows.Forms.ListBox Me.Button1 = New System.Windows.Forms.Button Me.Button2 = New System.Windows.Forms.Button Me.Button3 = New System.Windows.Forms.Button Me.Button4 = New System.Windows.Forms.Button Me.Button5 = New System.Windows.Forms.Button Me.CheckBox1 = New System.Windows.Forms.CheckBox Me.GroupBox5 = New System.Windows.Forms.GroupBox Me.RadioButton4 = New System.Windows.Forms.RadioButton Me.RadioButton5 = New System.Windows.Forms.RadioButton Me.GroupBox1.SuspendLayout() Me.GroupBox2.SuspendLayout() Me.GroupBox3.SuspendLayout() Me.GroupBox4.SuspendLayout() Me.GroupBox5.SuspendLayout() Me.SuspendLayout() ' 'GroupBox1 ' Me.GroupBox1.Controls.Add(Me.TextBox3) Me.GroupBox1.Controls.Add(Me.TextBox2) Me.GroupBox1.Controls.Add(Me.TextBox1) Me.GroupBox1.Controls.Add(Me.Label3) Me.GroupBox1.Controls.Add(Me.Label2) Me.GroupBox1.Controls.Add(Me.Label1) Me.GroupBox1.Controls.Add(Me.GroupBox2) Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.GroupBox1.Location = New System.Drawing.Point(0, 8) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(408, 192) Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Customer Information" ' 'TextBox3 ' Me.TextBox3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox3.Location = New System.Drawing.Point(176, 96) Me.TextBox3.Name = "TextBox3" Me.TextBox3.Size = New System.Drawing.Size(224, 23) Me.TextBox3.TabIndex = 6 Me.TextBox3.Text = "" ' 'TextBox2 ' Me.TextBox2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox2.Location = New System.Drawing.Point(176, 64) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(224, 23) Me.TextBox2.TabIndex = 5 Me.TextBox2.Text = "" ' 'TextBox1 ' Me.TextBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.TextBox1.Location = New System.Drawing.Point(176, 32) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(224, 23) Me.TextBox1.TabIndex = 4 Me.TextBox1.Text = "" ' 'Label3 ' Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label3.Location = New System.Drawing.Point(24, 96) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(144, 23) Me.Label3.TabIndex = 3 Me.Label3.Text = "Customer Phone" ' 'Label2 ' Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label2.Location = New System.Drawing.Point(24, 64) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(144, 23) Me.Label2.TabIndex = 2 Me.Label2.Text = "Customer Address" ' 'Label1 ' Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(24, 32) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(144, 23) Me.Label1.TabIndex = 1 Me.Label1.Text = "Customer Name" ' 'GroupBox2 ' Me.GroupBox2.Controls.Add(Me.RadioButton3) Me.GroupBox2.Controls.Add(Me.RadioButton2) Me.GroupBox2.Controls.Add(Me.RadioButton1) Me.GroupBox2.Location = New System.Drawing.Point(8, 128) Me.GroupBox2.Name = "GroupBox2" Me.GroupBox2.Size = New System.Drawing.Size(392, 56) Me.GroupBox2.TabIndex = 0 Me.GroupBox2.TabStop = False Me.GroupBox2.Text = "Payment Options" ' 'RadioButton3 ' Me.RadioButton3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.RadioButton3.Location = New System.Drawing.Point(272, 24) Me.RadioButton3.Name = "RadioButton3" Me.RadioButton3.TabIndex = 2 Me.RadioButton3.Text = "Payment Due" ' 'RadioButton2 ' Me.RadioButton2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.RadioButton2.Location = New System.Drawing.Point(136, 24) Me.RadioButton2.Name = "RadioButton2" Me.RadioButton2.TabIndex = 1 Me.RadioButton2.Text = "Partial Payment" ' 'RadioButton1 ' Me.RadioButton1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.RadioButton1.Location = New System.Drawing.Point(24, 24) Me.RadioButton1.Name = "RadioButton1" Me.RadioButton1.TabIndex = 0 Me.RadioButton1.Text = "Paid In Full" ' 'GroupBox3 ' Me.GroupBox3.Controls.Add(Me.ComboBox2) Me.GroupBox3.Controls.Add(Me.ComboBox1) Me.GroupBox3.Location = New System.Drawing.Point(0, 264) Me.GroupBox3.Name = "GroupBox3" Me.GroupBox3.Size = New System.Drawing.Size(408, 48) Me.GroupBox3.TabIndex = 1 Me.GroupBox3.TabStop = False Me.GroupBox3.Text = "Plane Seating " ' 'ComboBox2 ' Me.ComboBox2.Items.AddRange(New Object() {"Row 2", "Seat 1:*", "Seat 2:*", "Seat 3:*", "Seat 4:*", "Seat 5:*", "Seat 6:*"}) Me.ComboBox2.Location = New System.Drawing.Point(216, 16) Me.ComboBox2.Name = "ComboBox2" Me.ComboBox2.Size = New System.Drawing.Size(184, 21) Me.ComboBox2.TabIndex = 1 Me.ComboBox2.Text = "Row 2" ' 'ComboBox1 ' Me.ComboBox1.Items.AddRange(New Object() {"Row 1", "Seat 1:*", "Seat 2:*", "Seat 3:*", "Seat 4:*", "Seat 5:*", "Seat 6:*"}) Me.ComboBox1.Location = New System.Drawing.Point(16, 16) Me.ComboBox1.Name = "ComboBox1" Me.ComboBox1.Size = New System.Drawing.Size(192, 21) Me.ComboBox1.TabIndex = 0 Me.ComboBox1.Text = "Row 1" ' 'GroupBox4 ' Me.GroupBox4.Controls.Add(Me.ListBox1) Me.GroupBox4.Location = New System.Drawing.Point(8, 312) Me.GroupBox4.Name = "GroupBox4" Me.GroupBox4.Size = New System.Drawing.Size(200, 136) Me.GroupBox4.TabIndex = 2 Me.GroupBox4.TabStop = False Me.GroupBox4.Text = "Information Display" ' 'ListBox1 ' Me.ListBox1.Location = New System.Drawing.Point(8, 16) Me.ListBox1.Name = "ListBox1" Me.ListBox1.Size = New System.Drawing.Size(184, 108) Me.ListBox1.TabIndex = 0 ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(320, 328) Me.Button1.Name = "Button1" Me.Button1.TabIndex = 3 Me.Button1.Text = "Assign" ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(320, 352) Me.Button2.Name = "Button2" Me.Button2.TabIndex = 4 Me.Button2.Text = "Display" ' 'Button3 ' Me.Button3.Location = New System.Drawing.Point(320, 400) Me.Button3.Name = "Button3" Me.Button3.TabIndex = 5 Me.Button3.Text = "Clear" ' 'Button4 ' Me.Button4.Location = New System.Drawing.Point(320, 424) Me.Button4.Name = "Button4" Me.Button4.TabIndex = 6 Me.Button4.Text = "Quit" ' 'Button5 ' Me.Button5.Location = New System.Drawing.Point(320, 376) Me.Button5.Name = "Button5" Me.Button5.TabIndex = 7 Me.Button5.Text = "Delete" ' 'CheckBox1 ' Me.CheckBox1.Location = New System.Drawing.Point(216, 320) Me.CheckBox1.Name = "CheckBox1" Me.CheckBox1.TabIndex = 8 Me.CheckBox1.Text = "Payment Due" ' 'GroupBox5 ' Me.GroupBox5.Controls.Add(Me.RadioButton5) Me.GroupBox5.Controls.Add(Me.RadioButton4) Me.GroupBox5.Location = New System.Drawing.Point(16, 208) Me.GroupBox5.Name = "GroupBox5" Me.GroupBox5.Size = New System.Drawing.Size(392, 48) Me.GroupBox5.TabIndex = 9 Me.GroupBox5.TabStop = False Me.GroupBox5.Text = "Display Options" ' 'RadioButton4 ' Me.RadioButton4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.RadioButton4.Location = New System.Drawing.Point(16, 16) Me.RadioButton4.Name = "RadioButton4" Me.RadioButton4.Size = New System.Drawing.Size(176, 24) Me.RadioButton4.TabIndex = 0 Me.RadioButton4.Text = "Sorted Passenger List" ' 'RadioButton5 ' Me.RadioButton5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.RadioButton5.Location = New System.Drawing.Point(200, 16) Me.RadioButton5.Name = "RadioButton5" Me.RadioButton5.Size = New System.Drawing.Size(184, 24) Me.RadioButton5.TabIndex = 1 Me.RadioButton5.Text = "Passenger List by Seat Number" ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(424, 461) Me.Controls.Add(Me.GroupBox5) Me.Controls.Add(Me.CheckBox1) Me.Controls.Add(Me.Button5) Me.Controls.Add(Me.Button4) Me.Controls.Add(Me.Button3) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.GroupBox4) Me.Controls.Add(Me.GroupBox3) Me.Controls.Add(Me.GroupBox1) Me.Name = "Form1" Me.Text = "TWA Airline Company" Me.GroupBox1.ResumeLayout(False) Me.GroupBox2.ResumeLayout(False) Me.GroupBox3.ResumeLayout(False) Me.GroupBox4.ResumeLayout(False) Me.GroupBox5.ResumeLayout(False) Me.ResumeLayout(False) End Sub #End Region Structure passenger Public name As String Public address As String Public phone As String Public payment As String End Structure Public row1(6) As passenger Public row2(6) As passenger Public temp(13) As passenger Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim hold As Integer Dim payed As String = " " checker(payed) If payed = " " Then Exit Sub End If If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex > 0 Then hold = ComboBox2.SelectedIndex If ComboBox2.Text = "Seat " & (hold) & ":*" Then box2_add(hold, payed) Else MessageBox.Show("Seat is already Filled", "Invalid Selection") Exit Sub End If Else If ComboBox2.SelectedIndex = 0 And ComboBox1.SelectedIndex > 0 Then hold = ComboBox1.SelectedIndex If ComboBox1.Text = "Seat " & (hold) & ":*" Then box1_add(hold, payed) Else MessageBox.Show("Seat is already Filled", "Invalid Selection") Exit Sub End If Else If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 0 Then next_seat() Else MessageBox.Show("Please Select only One Seat", "Bad Information") Exit Sub End If End If End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim hold As Integer Dim payment2 As String Dim payment1 As String Dim variable1 As Integer If CheckBox1.Checked = True Then 'Display all Passengers owing money Dim x As Integer ListBox1.Items.Clear() ListBox1.Items.Add(" Unsettled Payments") For x = 1 To 6 Step 1 If row1(x).payment = "Paid in Full" Or row1(x).payment = "" Then Else ListBox1.Items.Add(row1(x).name & " owes TWA") End If Next For x = 1 To 6 Step 1 If row2(x).payment = "Paid in Full" Or row2(x).payment = "" Then Else ListBox1.Items.Add(row2(x).name & " owes TWA") End If Next CheckBox1.Checked = False Exit Sub End If If RadioButton4.Checked = True Then sort() Exit Sub End If If RadioButton5.Checked = True Then ListBox1.Items.Clear() ListBox1.Items.Add(" Row 1") For variable1 = 1 To 6 Step 1 If row1(variable1).name = "" Then Else ListBox1.Items.Add(row1(variable1).name & " is in seat " & variable1) End If Next ListBox1.Items.Add(" Row 2") For variable1 = 1 To 6 Step 1 If row2(variable1).name = "" Then Else ListBox1.Items.Add(row2(variable1).name & " is in seat " & variable1) End If Next Exit Sub End If If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex > 0 Then hold = ComboBox2.SelectedIndex ListBox1.Items.Clear() ListBox1.Items.Add("Name :" & row2(hold).name) ListBox1.Items.Add("Address :" & row2(hold).address) ListBox1.Items.Add("Phone :" & row2(hold).phone) ListBox1.Items.Add("Payment Status:" & row2(hold).payment) ComboBox2.Text = "Row 2" Else If ComboBox2.SelectedIndex = 0 And ComboBox1.SelectedIndex > 0 Then hold = ComboBox1.SelectedIndex ListBox1.Items.Clear() ListBox1.Items.Add("Name :" & row1(hold).name) ListBox1.Items.Add("Address :" & row1(hold).address) ListBox1.Items.Add("Phone :" & row1(hold).phone) ListBox1.Items.Add("Payment Status:" & row1(hold).payment) ComboBox1.Text = "Row 1" Else MessageBox.Show("Please select only one row", "Bad User Bad NO Biscuit") End If End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 'reset all fields TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() ListBox1.Items.Clear() ComboBox1.Text = "Row 1" ComboBox2.Text = "Row 2" RadioButton1.Checked = False RadioButton2.Checked = False RadioButton3.Checked = False RadioButton4.Checked = False RadioButton5.Checked = False CheckBox1.Checked = False End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click 'quit Me.Close() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim hold As Integer Dim name As String If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex > 0 Then hold = ComboBox2.SelectedIndex box2_remove(hold) Else If ComboBox2.SelectedIndex = 0 And ComboBox1.SelectedIndex > 0 Then hold = ComboBox1.SelectedIndex box1_remove(hold) Else If ComboBox2.SelectedIndex = 0 And ComboBox1.SelectedIndex = 0 Then name = InputBox("Please enter passenger to be removed", "Passenger Deletion") For hold = 1 To 6 Step 1 If row1(hold).name = name Then box1_remove(hold) Exit Sub End If Next For hold = 1 To 6 Step 1 If row2(hold).name = name Then box2_remove(hold) Exit Sub End If Next MessageBox.Show("Passenger name not found", "Invalid Name") End If End If End If End Sub Sub checker(ByRef payed As String) 'verify values coming in and assign payment value Dim verify As String Try verify = CStr(TextBox1.Text) verify = CStr(TextBox2.Text) verify = CStr(TextBox3.Text) Catch ex As Exception MessageBox.Show("Please Enter Information", "Invalid Information") Exit Sub End Try paystate(payed) End Sub Sub paystate(ByRef payed As String) If RadioButton1.Checked = True Then payed = "Paid in Full" Else If RadioButton2.Checked = True Then payed = "Partial Payment" Else If RadioButton3.Checked = True Then payed = "Payment Due" Else MessageBox.Show("Please select payment", "Information Missing") Exit Sub End If End If End If End Sub Sub next_seat() Dim value As Integer Dim hold As Integer Dim payed As String = " " If payed = "" Then Exit Sub End If value = MessageBox.Show("Select the next available Seat?", "Next Seat", MessageBoxButtons.YesNo) If value = DialogResult.Yes Then For hold = 1 To 6 Step 1 If row1(hold).name = "" Then paystate(payed) box1_add(hold, payed) Exit Sub End If Next For hold = 1 To 6 Step 1 If row2(hold).name = "" Then paystate(payed) box2_add(hold, payed) Exit Sub End If Next MessageBox.Show("No available seats", "Plane is Filled") End If End Sub Sub box1_add(ByVal hold As Integer, ByVal payed As String) row1(hold).name = TextBox1.Text row1(hold).address = TextBox2.Text row1(hold).phone = TextBox3.Text row1(hold).payment = payed ComboBox1.Items.RemoveAt(hold) ComboBox1.Items.Insert(hold, "Seat " & (hold) & ": " & TextBox1.Text) ComboBox1.Text = "Row 1" End Sub Sub box2_add(ByVal hold As Integer, ByVal payed As String) row2(hold).name = TextBox1.Text row2(hold).address = TextBox2.Text row2(hold).phone = TextBox3.Text row2(hold).payment = payed ComboBox2.Items.RemoveAt(hold) ComboBox2.Items.Insert(hold, "Seat " & (hold) & ": " & TextBox1.Text) ComboBox2.Text = "Row 2" End Sub Sub box1_remove(ByVal hold As Integer) ComboBox1.Items.RemoveAt(hold) ComboBox1.Items.Insert(hold, "Seat " & hold & ":*") ComboBox1.Text = "Row 1" row1(hold).name = "" row1(hold).address = "" row1(hold).phone = "" row1(hold).payment = "" End Sub Sub box2_remove(ByVal hold As Integer) ComboBox2.Items.RemoveAt(hold) ComboBox2.Items.Insert(hold, "Seat " & hold & ":*") ComboBox2.Text = "Row 1" row2(hold).name = "" row2(hold).address = "" row2(hold).phone = "" row2(hold).payment = "" End Sub Sub sort() Dim variable1 As Integer Dim variable2 As Integer Dim upper As Integer = 12 Dim hold As passenger For variable1 = 0 To 6 Step 1 temp(variable1) = row1(variable1) Next For variable1 = 0 To 6 Step 1 temp(variable1 + 7) = row2(variable1) Next For variable1 = 0 To 12 Step 1 For variable2 = 0 To 12 Step 1 If temp(variable2).name > temp(variable2 + 1).name Then hold = temp(variable2) temp(variable2) = temp(variable2 + 1) temp(variable2 + 1) = hold End If Next Next ListBox1.Items.Clear() For variable1 = 0 To 13 Step 1 If temp(variable1).name = "" Then Else ListBox1.Items.Add(temp(variable1).name & " is seated on the plane") End If Next End Sub End Class