I am a beginning student attempting to write a class. I am missing something, but I don't know what. This is supposed to simulate parking spaces arranged linearly, where I need to determine the # of parking spaces used in one day. Here is what I have so far.


Public Class OfficeParking

Public Function spacesUsed(ByVal events As String()) As Integer
Dim intIndex As Integer
Dim total As Integer

intIndex = 0

Do While intIndex < events.length()
Select Case events(intIndex)
Case "arrives"
total = total + events(intIndex) + 1
Case "departs"
total = total + events(intIndex) - 1
End Select
intIndex = intIndex + 1
Loop
total = total + 1
spacesUsed = total
End Function
End Class