Exemplo n.º 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();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Farm   farm   = new Farm("Айыл Чарба", "г.Бишкек ул.Чуй №182");
            Animal cow    = new Cow("Уй", 2, "Ж", 740);
            Animal cow1   = new Cow("Бука", 2, "М", 760);
            Sheep  sheep  = new Sheep("Кой", 5, "Ж", 48);
            Sheep  sheep1 = new Sheep("Кочкор", 3, "М", 60);
            Animal horse  = new Horse("Ат", 7, "М", 650);
            Animal horse1 = new Horse("Бээ", 7, "Ж", 650);

            cow.Eat();
            sheep.Eat();
            horse.Eat();

            while (true)
            {
                farm.FullInfo();
                Console.Write("Для добавление животных в ферму выберите из списка " +
                              "\ncow-->уй\tcow1-->бука\nsheep-->кой\tsheep1-->кочкор\nhorse-->ат\thorse1-->бээ\n>");

                var input = Console.ReadLine().ToLower();

                switch (input)
                {
                case "cow":
                    farm.AddCow(cow); break;

                case "cow1":
                    farm.AddCow(cow1); break;

                case "sheep":
                    farm.AddSheep(sheep); break;

                case "sheep1":
                    farm.AddSheep(sheep1); break;

                case "horse":
                    farm.AddHorse(horse); break;

                case "horse1":
                    farm.AddHorse(horse1); break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 3
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");
            }
        }
Exemplo n.º 4
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();
        }