|
-
Mar 23rd, 2004, 03:17 PM
#1
Thread Starter
New Member
class
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|