Results 1 to 2 of 2

Thread: class

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2004
    Posts
    1

    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

  2. #2
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    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
  •  



Click Here to Expand Forum to Full Width