Exemple #1
0
        static void Main(string[] args)
        {
            Horse Horsey = new Horse();

            Horsey.Speak("Horsey");
            Horsey.Eat();
            Horsey.Move();
            Horsey.Produce();
            Horsey.Food();

            Chicken Chickie = new Chicken();

            Chickie.Speak("Chickie");
            Chickie.Eat();
            Chickie.Move();
            Chickie.Produce();
            Chickie.Food();

            Cow Cowie = new Cow();

            Cowie.Speak("Cowie");
            Cowie.Eat();
            Cowie.Move();
            Cowie.Produce();
            Cowie.Food();

            Pig Piggie = new Pig();

            Piggie.Speak("Piggie");
            Piggie.Eat();
            Piggie.Move();
            Piggie.Produce();
            Piggie.Food();
        }
Exemple #2
0
        static void farmWork()
        {
            Console.WriteLine("A Waddle with a Duck");
            duck myduck = new duck();

            myduck.animalSays("Quack Quack");
            myduck.eatGrain();
            myduck.findWater();
            myduck.Move();

            Console.WriteLine("A Wallow with a Pig");
            pig mypig = new pig();

            mypig.animalSays("Oink Oink");
            mypig.eatSlop();
            mypig.mudRoll();
            mypig.Move();

            Console.WriteLine("A Gallop with a Horse");
            Horse myhorse = new Horse();

            myhorse.animalSays("Neigh, Neigh");
            myhorse.eatHay();
            myhorse.saddleFit();
            myhorse.Move();

            Console.WriteLine("A Stroll with a Cow");
            cow mycow = new cow();

            mycow.animalSays("Moooooooooo!");
            mycow.eatGrass();
            mycow.gotMilk();
            mycow.Move();

            Console.WriteLine("A Talk with a Goat");
            goat mygoat = new goat();

            mygoat.animalSays("Baaaaaa, Baaaa");
            mygoat.eatFeed();
            mygoat.climbRocks();
            mygoat.Move();
        }