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);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // SkyAnimals
            Finch    finchy = new Finch();
            Parakeet perry  = new Parakeet();
            // LandAnimals
            Mice   mousey   = new Mice();
            Gerbil gerbilly = new Gerbil();
            // WaterAnimals
            BettaFish betty = new BettaFish();
            Terrapin  terry = new Terrapin();
            // UnderGroundAnimals
            Ant               auntJemima = new Ant();
            CopperheadSnake   copperFace = new CopperheadSnake();
            Earthworm         wormy      = new Earthworm();
            TimberRattlesnake shiver     = new TimberRattlesnake();

            Flying      SkyAnimals         = new Flying();
            OnGround    LandAnimals        = new OnGround();
            Swimming    WaterAnimals       = new Swimming();
            UnderGround UnderGroundAnimals = new UnderGround();

            SkyAnimals.FlyingAnimals.Add(finchy);
            SkyAnimals.FlyingAnimals.Add(perry);

            LandAnimals.OnGroundAnimals.Add(mousey);
            LandAnimals.OnGroundAnimals.Add(gerbilly);

            WaterAnimals.SwimmingAnimals.Add(betty);
            WaterAnimals.SwimmingAnimals.Add(terry);

            UnderGroundAnimals.UnderGroundAnimals.Add(auntJemima);
            UnderGroundAnimals.UnderGroundAnimals.Add(copperFace);
            UnderGroundAnimals.UnderGroundAnimals.Add(wormy);
            UnderGroundAnimals.UnderGroundAnimals.Add(shiver);
        }
Exemplo n.º 3
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();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Ant ant = new Ant()
            {
                Dig   = true,
                Name  = "Ant",
                Color = "brown",
                Food  = "dirt"
            };

            BettaFish betta = new BettaFish()
            {
                Swim  = true,
                Name  = "Betta",
                Color = "red",
                Food  = "food"
            };

            CopperheadSnake copperSnake = new CopperheadSnake()
            {
                Move  = true,
                Name  = "Copper",
                Color = "brown",
                Food  = "mice"
            };

            Earthworm worm = new Earthworm()
            {
                Dig   = true,
                Name  = "Worm",
                Color = "brown",
                Food  = "dirt"
            };

            Finch bird = new Finch()
            {
                Fly   = true,
                Name  = "Bird",
                Color = "orange",
                Food  = "seeds"
            };

            Gerbil gerbil = new Gerbil()
            {
                Move  = true,
                Name  = "Gerbil",
                Color = "brown",
                Food  = "seeds"
            };

            Mice mouse = new Mice()
            {
                Move  = true,
                Name  = "Mouse",
                Color = "white",
                Food  = "seeds"
            };

            Parakeet smallBird = new Parakeet()
            {
                Fly   = true,
                Name  = "Parakeet",
                Color = "orange",
                Food  = "seeds"
            };

            Rattlesnake rattler = new Rattlesnake()
            {
                Move  = true,
                Name  = "Rattler",
                Color = "green",
                Food  = "rats"
            };

            Terrapin turtle = new Terrapin()
            {
                Swim  = true,
                Name  = "Turts",
                Color = "green",
                Food  = "fish"
            };

            Container animalContainer = new Container();

            animalContainer.Diggers.Add(worm);
            animalContainer.Diggers.Add(ant);
            animalContainer.Movers.Add(copperSnake);
            animalContainer.Movers.Add(gerbil);
            animalContainer.Movers.Add(mouse);
            animalContainer.Movers.Add(rattler);
            animalContainer.Fliers.Add(bird);
            animalContainer.Fliers.Add(smallBird);
            animalContainer.Swimmers.Add(betta);
            animalContainer.Swimmers.Add(turtle);

            foreach (var animal in animalContainer.Diggers)
            {
                Console.WriteLine(animal.ToString());
            }

            foreach (var animal in animalContainer.Movers)
            {
                Console.WriteLine(animal.ToString());
            }

            foreach (var animal in animalContainer.Fliers)
            {
                Console.WriteLine(animal.ToString());
            }

            foreach (var animal in animalContainer.Swimmers)
            {
                Console.WriteLine(animal.ToString());
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Earthworm LongEarthWorm = new Earthworm();
            Ant       StrongAnt     = new Ant();

            List <DigandLiveContainer> DigandLiveContainersList = new List <DigandLiveContainer>()
            {
                LongEarthWorm,
                StrongAnt,
            };

            foreach (DigandLiveContainer animal in DigandLiveContainersList)
            {
                Console.WriteLine("I am in the IN-ground container");
            }

            CopperheadSnake   BadSnake    = new CopperheadSnake();
            Gerbil            LoveGerbil  = new Gerbil();
            Mice              UglyMice    = new Mice();
            Terrapin          MyTerrapin  = new Terrapin();
            TimberRattlesnake OhThisSnake = new TimberRattlesnake();

            List <MoveOnGroundContainer> MoveOnGroundContainerList = new List <MoveOnGroundContainer>()
            {
                BadSnake,
                LoveGerbil,
                UglyMice,
                MyTerrapin,
                OhThisSnake,
            };

            foreach (MoveOnGroundContainer animal in MoveOnGroundContainerList)
            {
                Console.WriteLine("I am running around the ground container");
            }
            BettaFish LonelyFish = new BettaFish();

            List <SwimContainer> SwimContainerList = new List <SwimContainer>()
            {
                LonelyFish,
            };

            foreach (SwimContainer animal in SwimContainerList)
            {
                Console.WriteLine("I am stuck in the swim container");
            }

            Parakeet FlyHigh     = new Parakeet();
            Finch    FlyFinchFly = new Finch();

            List <FlyContainer> FlyContainerList = new List <FlyContainer>()
            {
                FlyHigh,
                FlyFinchFly,
            };

            foreach (FlyContainer animal in FlyContainerList)
            {
                Console.WriteLine("I am flying around this cage");
            }
        }