示例#1
0
        public void AddAnimal(int input)
        {
            if (input == 1)
            {
                Console.Clear();
                Cat newCat = new Cat();
                Console.WriteLine("Type in the cat name");
                newCat.Name = Console.ReadLine();
                Console.WriteLine("Type in the cat age");
                newCat.Age    = int.Parse(Console.ReadLine());
                newCat.CanRun = true;
                Console.WriteLine("Type in the cat breed");
                newCat.Breed        = Console.ReadLine();
                newCat.NumberOfLegs = 4;

                catList.Add(newCat);
            }
            if (input == 2)
            {
                Console.Clear();
                Shark newShark = new Shark();
                Console.WriteLine("Type in the shark name");
                newShark.Name = Console.ReadLine();
                Console.WriteLine("Type in the shark age");
                newShark.Age               = int.Parse(Console.ReadLine());
                newShark.CanSwim           = true;
                newShark.BreatheUnderwater = true;
                newShark.IsDangeorous      = true;

                sharkList.Add(newShark);
            }
            if (input == 3)
            {
                Console.Clear();
                Eagle newEagle = new Eagle();
                Console.WriteLine("Type in the eagle name");
                newEagle.Name = Console.ReadLine();
                Console.WriteLine("Type in the eagle age");
                newEagle.Age = int.Parse(Console.ReadLine());
                Console.WriteLine("Type in the color of the eagle");
                newEagle.Color = Console.ReadLine();
                Console.WriteLine("How high can the eagle fly?");
                newEagle.FlightHeight = int.Parse(Console.ReadLine());
                newEagle.CanFly       = true;

                eagleList.Add(newEagle);
            }
        }
示例#2
0
        public void PartOneLab()
        {
            Console.Clear();
            Console.WriteLine("CATS");
            Cat cat = new Cat();

            cat.Move();
            cat.AnimalSound();
            Console.WriteLine();
            Console.WriteLine("SHARKS");
            Shark shark = new Shark();

            shark.Move();
            shark.AnimalSound();
            Console.WriteLine(
                );
            Console.WriteLine("EAGLES");
            Eagle eagle = new Eagle();

            eagle.Move();
            eagle.AnimalSound();
            Console.Read();
        }