Ejemplo n.º 1
0
        private static void Menu2(int menu)
        {
            int menu2 = Convert.ToInt32(Console.ReadLine());

            if (menu2 == 1)
            {
                Horse horse1 = new Horse();
                horse1.Speak();
                Animal1();
                Menu2(menu);
            }
            else if (menu2 == 2)
            {
                Horse horse1 = new Horse();
                horse1.Eat();
                Animal1();
                Menu2(menu);
            }
            else if (menu2 == 3)
            {
                Horse horse1 = new Horse();
                horse1.Run();
                Animal1();
                Menu2(menu);
            }
            else if (menu2 == 4)
            {
                Horse horse1 = new Horse();
                horse1.Attack();
                Animal1();
                Menu2(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();
        }