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:28

Here is my code:

using System;
class Arm : IBendable
{
    public Arm()
    {

    }
    public void Raise()
    {
        Console.WriteLine("Raising arm up.");
    }
    public void Bend()
    {
        this.Raise();
    }
}
class Spoon : IBendable
{
    public Spoon()
    {

    }
    public void Eat()
    {
        Console.WriteLine("Eating from the spoon.");
    }
    public void Bend()
    {
        this.Eat();
    }
}

class Prog6_18
{
    static void Main(string[] args)
    {
       
        Spoon childsSpoon = new Spoon();
        Arm childsArm = new Arm();
        EatFood(childsArm);
        EatFood(childsSpoon);

    }
    public static void EatFood(IBendable a)
    {
        a.Bend();
    }
        public interface IBendable
        {
            void Bend();
        }
    }

Not asking for free help or for someone to make it for me.  Asking for professional assistance.

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