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);
        }
        static void Main(string[] args)
        {
            // Animal Instances

            Parakeet          parakeet    = new Parakeet();
            Ant               ant         = new Ant();
            BettaFish         bettaFish   = new BettaFish();
            CopperheadSnake   copperSnake = new CopperheadSnake();
            Earthworm         earthworm   = new Earthworm();
            Finch             finch       = new Finch();
            Gerbil            gerbil      = new Gerbil();
            Mouse             mouse       = new Mouse();
            Terrapin          terrapin    = new Terrapin();
            TimberRattlesnake timberSnake = new TimberRattlesnake();

            // Container Instances
            // Creating a List of particular Interface to hold animals of a certain type
            // Adding animals to their rightful container

            Digger diggerContainer = new Digger();

            diggerContainer.diggers = new List <IDigable>()
            {
                gerbil, earthworm, ant
            };

            Swimmer swimmerContainer = new Swimmer();

            swimmerContainer.swimmers = new List <ISwimable>()
            {
                bettaFish, terrapin
            };

            Flyer flyerContainer = new Flyer();

            flyerContainer.flyers = new List <IFlyable>()
            {
                parakeet, finch
            };


            Walker walkerContainer = new Walker();

            walkerContainer.walkers = new List <IWalkable>()
            {
                timberSnake, copperSnake, mouse
            };
        }
예제 #3
0
        static void Main(string[] args)
        {
            Ant               redAnt                 = new Ant();
            BettaFish         blackBettaFish         = new BettaFish();
            CopperheadSnake   whiteSnake             = new CopperheadSnake();
            Earthworm         pinkEarthworm          = new Earthworm();
            Finch             greyFinch              = new Finch();
            Gerbil            brownGerbil            = new Gerbil();
            Mouse             whiteMouse             = new Mouse();
            Parakeet          blueParakeet           = new Parakeet();
            Terrapin          greenTerrapin          = new Terrapin();
            TimberRattlesnake brownTimberRattlesnake = new TimberRattlesnake();

            Animals          MyAnimals          = new Animals();
            List <IWalking>  GroundHabitat      = MyAnimals.MakeGroundHabitat();
            List <IFlying>   AirHabitat         = MyAnimals.MakeAirHabitat();
            List <IDigging>  UndergroundHabitat = MyAnimals.MakeUndergroundHabitat();
            List <ISwimming> WaterHabitat       = MyAnimals.MakeWaterHabitat();
        }
예제 #4
0
        static void Main(string[] args)
        {
            Ant             ant         = new Ant();
            BettaFish       bettaFish   = new BettaFish();
            CopperheadSnake copperhead  = new CopperheadSnake();
            Earthworm       earthworm   = new Earthworm();
            Finch           finch       = new Finch();
            Gerbil          gerbil      = new Gerbil();
            Mouse           mouse       = new Mouse();
            Parakeet        parakeet    = new Parakeet();
            Rattlesnake     rattlesnake = new Rattlesnake();
            Terrapin        terrapin    = new Terrapin();

            AnimalsThatDig diggers = new AnimalsThatDig();

            diggers.AnimalsThatDigList.Add(ant);
            diggers.AnimalsThatDigList.Add(earthworm);


            AnimalsThatFly fliers = new AnimalsThatFly();

            fliers.AnimalsThatFlyList.Add(parakeet);
            fliers.AnimalsThatFlyList.Add(finch);

            AnimalsThatMoveOnGround movers = new AnimalsThatMoveOnGround();

            movers.AnimalsThatMoveOnGroundList.Add(copperhead);
            movers.AnimalsThatMoveOnGroundList.Add(gerbil);
            movers.AnimalsThatMoveOnGroundList.Add(mouse);
            movers.AnimalsThatMoveOnGroundList.Add(rattlesnake);

            AnimalsThatSwim swimmers = new AnimalsThatSwim();

            swimmers.AnimalsThatSwimList.Add(bettaFish);
            swimmers.AnimalsThatSwimList.Add(terrapin);
        }
예제 #5
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);
        }
예제 #6
0
        static void Main(string[] args)
        {
            // Instantiate ground animals
            TimberRattler timberRattler1 = new TimberRattler();
            Mouse         mouse1         = new Mouse();
            Copperhead    copperhead1    = new Copperhead();
            Gerbil        gerbil1        = new Gerbil();

            // Instantiate digger animals
            Earthworm earthworm1 = new Earthworm();
            Ant       ant1       = new Ant();

            // Instantiate flyer animals
            Parakeet parakeet1 = new Parakeet();
            Finch    finch1    = new Finch();

            // Instantiate swimming animals
            BettaFish bettaFish1 = new BettaFish();
            Terrapin  terrapin1  = new Terrapin();

            GroundBox  groundBox1  = new GroundBox();
            DiggerBox  diggerBox1  = new DiggerBox();
            FlyerBox   flyerBox1   = new FlyerBox();
            SwimmerBox swimmerBox1 = new SwimmerBox();

            // Add ground animals to the ground box
            groundBox1.GroundAnimals.Add(timberRattler1);
            groundBox1.GroundAnimals.Add(mouse1);
            groundBox1.GroundAnimals.Add(copperhead1);
            groundBox1.GroundAnimals.Add(gerbil1);

            // Add digger animals to the digger box
            diggerBox1.DiggingAnimals.Add(earthworm1);
            diggerBox1.DiggingAnimals.Add(ant1);

            // Add flyer animals to the flyer box
            flyerBox1.FlyingAnimals.Add(parakeet1);
            flyerBox1.FlyingAnimals.Add(finch1);

            // Add swimming animals to the swimmer box
            swimmerBox1.SwimmingAnimals.Add(bettaFish1);
            swimmerBox1.SwimmingAnimals.Add(terrapin1);

            // for each item in each box, execute the common method that belongs to each animal
            foreach (IGroundable groundAnimal in groundBox1.GroundAnimals)
            {
                groundAnimal.MoveOnGround();
            }

            foreach (IDigable diggerAnimal in diggerBox1.DiggingAnimals)
            {
                diggerAnimal.Dig();
            }

            foreach (IFlyable flyerAnimal in flyerBox1.FlyingAnimals)
            {
                flyerAnimal.Fly();
            }

            foreach (ISwimable swimmingAnimal in swimmerBox1.SwimmingAnimals)
            {
                swimmingAnimal.Swim();
            }
        }
예제 #7
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());
            }
        }
예제 #8
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();
        }
예제 #9
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");
            }
        }