Some VB .NET help

Discussion in 'OT Technology' started by Lee, Nov 6, 2008.

  1. Lee

    Lee New Member

    Joined:
    Aug 25, 2003
    Messages:
    1,079
    Likes Received:
    0
    Location:
    Cincinnati, OH
    I'm trying to learn VB .NET from some books and the web. I like to do the practice programs so I'm not just "reading" but "doing" what I'm learning, (or trying to learn). I'm stuck on 2 of them. I'll just post this one for now. I can write it (sort of) just using a bunch of nested if statements and so on however a friend of mine told me that's not exactly the way there wanting it done here per the instructions. So I'm sort of stuck and just need to see how it should look to satisfy the instructions.

     
  2. Frequency

    Frequency New Member

    Joined:
    Dec 30, 2004
    Messages:
    7,504
    Likes Received:
    0
    Location:
    PA
    Its kind of hard to tell what the book is looking for with-out knowing what you should know at this point in the book and what you've been taught so far.
    With that said it appears you need will need 2 classes for the shapes

    This is just pseudo code
    Code:
    Class Sphere
       Int Diameter
    
       Function Int Volume()
            Return 1.25 * Pi * (Diameter ^ 3)
       End Function
     
        Function Int Area()
          Return 4 * Pi * (Diameter ^ 2)
        End Function
    
       Sub Override ToString()
          Return "I am an object with a height of %1, width of %2 and length of %3"
       End Function
    End Class
    
    Class Square
       Int Length
       Int Width
       Int Height
    
       Function Int Volume()
          Return Length * Width * Height
       End Function
    
       Function Int Area()
          Return Length * Width
       End Function
    
       Sub Override ToString()
          Return "I am an object with a height of %1, width of %2 and length of %3"
       End Function
    End Class
    
    Hopefully this point you in the right direction, someone else may jump in and help more, but i gotta bounce, i'll check back later tonight(maybe)
     

Share This Page