Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

HALP Prog question

Name: Anonymous 2007-11-12 18:02

Create an interface, "IBendable", with one method, "Bend".  Create two classes, "Spoon" and "Arm", that implement "IBendable". "Spoon" will also have an "Eat" method, and "Arm" will also have a  "Raise" method.  Each of these methods prints a message indicating its function.  Write another class with a "Main" method, declaring two objects of type "IBendable", one a "spoon" and another an "arm".  Call the "Bend" method.

help me pleeeeeeease

Name: Anonymous 2007-11-12 18:22

>>1
class IBendable:
    def Bend( self ):
        pass

class Spoon( IBendable ):
    def Bend( self ):
        print( "Spoon bent." )
   
    def Eat( self ):
        print( "Spoon ... eat." )

class Arm( IBendable ):
    def Bend( self ):
        print( "Arm bent." )

    def Raise( self ):
        print( "Arm raised." );

if ( __name__ == "__main__" ):
    spoon = Spoon()
    arm = Arm()
    spoon.Bend()
    arm.Bend()


Also, you're a gigantic faggot. /prog/ doesn't exist to do your homework.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List