Example #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();
        }
Example #2
0
        static void Main(string[] args)
        {
            //Animal animal = new Pig(); new Cow(); new Goat(); new Chicken();
            Console.WriteLine("Choose from the following options: ");
            Console.WriteLine("Chicken, Pig, Cow, Goat: ");
            string userInput = Console.ReadLine();

            Chicken myChicken = new Chicken();

            if (userInput == "Chicken" || userInput == "chicken")

            {
                myChicken.Eat();
                myChicken.NumberOfLegs();
                myChicken.Speak();
                myChicken.Use();
            }
            else if (userInput == "Pig" || userInput == "pig")
            {
                Pig myPig = new Pig();
                myPig.Eat();
                myPig.NumberOfLegs();
                myPig.Speak();
                myPig.Use();
            }
            else if (userInput == "Cow" || userInput == "cow")
            {
                Cow myCow = new Cow();
                myCow.Eat();
                myCow.NumberOfLegs();
                myCow.Speak();
                myCow.Use();
            }

            else if (userInput == "Goat" || userInput == "goat")
            {
                Goat myGoat = new Goat();
                myGoat.Eat();
                myGoat.NumberOfLegs();
                myGoat.Speak();
                myGoat.Use();
            }
            else
            {
                Console.WriteLine("Wrong Input");
            }
        }