|
-
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
-
Mar 23rd, 2004, 03:38 PM
#2
PowerPoster
Hi,
One thing springs to mind is that you are not checking for upper or lower case for "arrives" or "departs".
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
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
|