示例#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();
        }
示例#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");
            }
        }
示例#3
0
        private static void Menu5(int menu)
        {
            int menu5 = Convert.ToInt32(Console.ReadLine());

            if (menu5 == 1)
            {
                Cow cow1 = new Cow();
                cow1.Speak();
                Animal4();
                Menu5(menu);
            }
            else if (menu5 == 2)
            {
                Cow cow1 = new Cow();
                cow1.Eat();
                Animal4();
                Menu5(menu);
            }
            else if (menu5 == 3)
            {
                Cow cow1 = new Cow();
                cow1.Run();
                Animal4();
                Menu5(menu);
            }
            else if (menu5 == 4)
            {
                Cow cow1 = new Cow();
                cow1.Attack();
                Animal4();
                Menu5(menu);
            }
            else
            {
                Menu();
            }
        }
        static void Main(string[] args)
        {
            var horse = new Horse()
            {
                AnimalName = "Horse",
                Sound      = "NEIGH!!!",
                Speed      = 55,
                JumpHeight = 5
            };

            horse.Speak();
            horse.Noise();
            horse.Run();
            horse.Jump();

            Console.ReadLine();
            Console.Clear();

            var cow = new Cow()
            {
                AnimalName = "Cow",
                Sound      = "MOO!!!",
                Food       = "Grass",
                MeatAmount = 500,
            };

            cow.Speak();
            cow.Noise();
            cow.Eat();
            cow.SlaughterHouse();

            Console.ReadLine();
            Console.Clear();

            var turkey = new Turkey()
            {
                AnimalName = "Turkey",
                Sound      = "GOBBLE! GOBBLE!",
                Food       = "Corn",
                Holiday    = "Thanksgiving"
            };

            turkey.Speak();
            turkey.Noise();
            turkey.Eat();
            turkey.HolidayServed();

            Console.ReadLine();
            Console.Clear();

            var fox = new Fox()
            {
                AnimalName = "Fox",
                Sound      = "........(silent)",
                Food       = "Eggs",
                Smell      = "Chickens",
            };

            fox.Speak();
            fox.Noise();
            fox.Search();
            fox.Eat();


            Console.ReadLine();
        }