Public Class Form1
  Inherits System.Windows.Forms.Form
  Private empls(7) As Employee
  Private empl As Employee
  Private bos As Boss

  Private Sub init()
    Dim i As Integer = 1
    empls(i) = New Employee("Susan Bear", 55000, 12, 1)
    i = i + 1
    empls(i) = New Employee("Adam Gehr", 150000, 9, 0)
    i = i + 1
    empls(i) = New Employee("Fred Harris", 50000, 15, 2)
    i = i + 1
    empls(i) = New Employee("David Oakley", 57000, 12, 2)
    i = i + 1
    empls(i) = New Employee("Larry Thomas", 100000, 20, 6)
    i = i + 1
    bos = New Boss("Leslie Susi", 175000, 16, 4)
    bos.setBonusDays(12)
    empls(i) = bos
    i = i + 1
    bos = New Boss("Laurence Byerly", 35000, 17, 6)
    bos.setBonusDays(17)
    empls(i) = bos
  End Sub

#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
    init()
  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
  Friend WithEvents lsVac As System.Windows.Forms.ListBox
  Friend WithEvents btCompute As System.Windows.Forms.Button

  'Required by the Windows Form Designer
  Private components As System.ComponentModel.Container

  '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.
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.lsVac = New System.Windows.Forms.ListBox()
    Me.btCompute = New System.Windows.Forms.Button()
    Me.SuspendLayout()
    '
    'lsVac
    '
    Me.lsVac.Location = New System.Drawing.Point(16, 24)
    Me.lsVac.Name = "lsVac"
    Me.lsVac.Size = New System.Drawing.Size(256, 186)
    Me.lsVac.TabIndex = 0
    '
    'btCompute
    '
    Me.btCompute.Location = New System.Drawing.Point(96, 232)
    Me.btCompute.Name = "btCompute"
    Me.btCompute.Size = New System.Drawing.Size(72, 24)
    Me.btCompute.TabIndex = 1
    Me.btCompute.Text = "Compute"
    '
    'Form1
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(292, 273)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btCompute, Me.lsVac})
    Me.Name = "Form1"
    Me.Text = "Vacation visitor"
    Me.ResumeLayout(False)

  End Sub

#End Region

  Private Sub btCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btCompute.Click
    Dim i As Integer
    Dim vac As New VacationVisitor()
    Dim bvac As New bVacationVisitor()
    For i = 1 To empls.Length - 1
      empls(i).accept(vac)
      empls(i).accept(bvac)
    Next i
    lsVac.Items.Add("Total vacation days=" & vac.getTotalDays.ToString)
    lsVac.Items.Add("Total boss vacation days=" & bvac.getTotalDays.ToString)
  End Sub

End Class
