static void Main(string[] args)
        {
            List <IFly>      flyers   = new List <IFly>();
            List <ISwim>     swimmers = new List <ISwim>();
            List <IDigUnder> crawlers = new List <IDigUnder>();

            var myAnts              = new Ants();
            var myBettaFish         = new BettaFish();
            var myCopperheadSnake   = new CopperHeadSnake();
            var myEarthworms        = new Earthworms();
            var myFinches           = new Finches();
            var myGerbils           = new Gerbils();
            var myMice              = new Mice();
            var myParakeets         = new Parakeets();
            var myTerrapins         = new Terrapins();
            var myTimberRattlesnake = new TimberRattlesnake();

            flyers.Add(myParakeets);
            flyers.Add(myFinches);

            swimmers.Add(myBettaFish);
            swimmers.Add(myTerrapins);

            crawlers.Add(myAnts);
            crawlers.Add(myCopperheadSnake);
            crawlers.Add(myEarthworms);
            crawlers.Add(myGerbils);
            crawlers.Add(myMice);
            crawlers.Add(myTimberRattlesnake);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Ants ant = new Ants()
            {
                Name      = "Fire Ant",
                Type      = "Insect",
                DigSpeed  = 10,
                WalkSpeed = 3,
                RunSpeed  = 5
            };
            BettaFish bettaFish = new BettaFish()
            {
                Name      = "Betta Fish",
                Type      = "Fish",
                DiveSpeed = 1,
                SwimSpeed = 2
            };
            CopperHeadSnakes copperHead = new CopperHeadSnakes()
            {
                Name      = "Copper Head",
                Type      = "Snake",
                DiveSpeed = 3,
                SwimSpeed = 5,
                WalkSpeed = 8,
                RunSpeed  = 12
            };
            Earthworms earthWorm = new Earthworms()
            {
                Name      = "Earth Worm",
                Type      = "Worm",
                DigSpeed  = 2,
                WalkSpeed = 1,
                RunSpeed  = 2
            };
            Finches finch = new Finches()
            {
                Name         = "Finch",
                Type         = "Bird",
                DiveSpeed    = 5,
                SwimSpeed    = 5,
                WalkSpeed    = 1,
                RunSpeed     = 2,
                FlyDiveSpeed = 50,
                FlightSpeed  = 30
            };
            Gerbils gerbil = new Gerbils()
            {
                Name      = "Gerbil",
                Type      = "Rodentia",
                DiveSpeed = 1,
                SwimSpeed = 2,
                WalkSpeed = 4,
                RunSpeed  = 8,
                DigSpeed  = 3
            };
            Mice mouse = new Mice()
            {
                Name      = "Mouse",
                Type      = "Rodentia",
                DiveSpeed = 1,
                SwimSpeed = 2,
                WalkSpeed = 4,
                RunSpeed  = 8,
                DigSpeed  = 3
            };
            Parakeets parakeet = new Parakeets()
            {
                Name         = "ParaKeet",
                Type         = "Bird",
                DiveSpeed    = 5,
                SwimSpeed    = 5,
                WalkSpeed    = 1,
                RunSpeed     = 2,
                FlyDiveSpeed = 50,
                FlightSpeed  = 30
            };
            Terrapins terrapin = new Terrapins()
            {
                Name      = "Terrapin",
                Type      = "Turtle",
                DiveSpeed = 1,
                SwimSpeed = 3,
                WalkSpeed = 2,
                RunSpeed  = 3
            };
            TimberRattlesnakes timberRattleSnake = new TimberRattlesnakes()
            {
                Name      = "Timber Rattle Snake",
                Type      = "Snake",
                DiveSpeed = 3,
                SwimSpeed = 5,
                WalkSpeed = 8,
                RunSpeed  = 12
            };

            Animals animalLists = new Animals()
            {
                AboveGroundAnimals = new List <IAboveGround>()
                {
                    ant, copperHead, earthWorm, finch, gerbil, mouse, parakeet, terrapin, timberRattleSnake
                },
                FlyAboveGroundAnimals = new List <IFlyAboveGround>()
                {
                    finch, parakeet
                },
                UnderGroundAnimals = new List <IUnderGround>()
                {
                    ant, earthWorm, gerbil, mouse
                },
                UnderWaterAnimals = new List <IUnderWater>()
                {
                    bettaFish, copperHead, finch, gerbil, mouse, parakeet, terrapin, timberRattleSnake
                }
            };

            // Console.WriteLine("");
            // Console.WriteLine("Here is a list of animals that walk on land:");

            // foreach(IAboveGround animal in animalLists.AboveGroundAnimals)
            // {
            //     Console.WriteLine(animal);
            // }

            // Console.WriteLine("");
            // Console.WriteLine("Here is a list of animals that fly above the ground:");

            // foreach(IFlyAboveGround animal in animalLists.FlyAboveGroundAnimals)
            // {
            //     Console.WriteLine(animal);
            // }

            // Console.WriteLine("");
            // Console.WriteLine("Here is a list of animals that dig under ground:");

            // foreach(IUnderGround animal in animalLists.UnderGroundAnimals)
            // {
            //     Console.WriteLine(animal);
            // }

            // Console.WriteLine("");
            // Console.WriteLine("Here is a list of animals that swim under water:");

            // foreach(IUnderWater animal in animalLists.UnderWaterAnimals)
            // {
            //     Console.WriteLine(animal);
            // }

            Console.WriteLine("");
            ant.Dig();
            gerbil.Walk();
            mouse.Run();
            earthWorm.Dig();
            bettaFish.Swim();
            copperHead.Dive();
            finch.TakeOff();
            parakeet.Land();
            terrapin.Swim();
            timberRattleSnake.Surface();
        }