Пример #1
0
        public static void WaterAnimals()
        {
            Console.WriteLine("");
            Console.WriteLine("Dino-Shark I am!");
            DinoShark dinoShark = new DinoShark();

            Console.WriteLine($"Scales: {dinoShark.Scales}.");
            Console.WriteLine($"Packs: {dinoShark.Packs}.");
            Console.WriteLine($"Location: {dinoShark.Location}.");
            Console.WriteLine($"Eyes: {dinoShark.Eyes}.");
            Console.WriteLine($"Feeding Cost:${dinoShark.FeedCost}.");
            Console.WriteLine($"Are they safe: {dinoShark.Safe}.");
            Console.WriteLine($"Eat: {dinoShark.Eat()}.");
            Console.WriteLine($"How many eggs laid a year: {dinoShark.EggsPerYear()}.");


            Console.WriteLine("");
            Console.WriteLine("Octopus I am!");
            Octopus octopus = new Octopus();

            Console.WriteLine($"Scales: {octopus.Scales}.");
            Console.WriteLine($"Packs: {octopus.Packs}.");
            Console.WriteLine($"Location: {octopus.Location}.");
            Console.WriteLine($"Eyes: {octopus.Eyes}.");
            Console.WriteLine($"Feeding Cost:${octopus.FeedCost}.");
            Console.WriteLine($"Are they safe: {octopus.Safe}.");
            Console.WriteLine($"Eat: {octopus.Eat()}.");
            Console.WriteLine($"How many eggs laid a year: {octopus.EggsPerYear()}.");
            Console.WriteLine($"Smarts: {octopus.Smart()}.");

            Console.WriteLine("");
            Console.WriteLine("Orca I am!");
            Orca orca = new Orca();

            Console.WriteLine("");
            Console.WriteLine($"Tails: {orca.Tail}.");
            Console.WriteLine($"Packs: {orca.Packs}.");
            Console.WriteLine($"Location: {orca.Location}.");
            Console.WriteLine($"Eyes: {orca.Eyes}.");
            Console.WriteLine($"Feeding Cost:${orca.FeedCost}.");
            Console.WriteLine($"Are they safe: {orca.Safe}.");
            Console.WriteLine($"Eat: {orca.Eat()}.");
            Console.WriteLine($"How many does it give birth per year: {orca.GiveBirth()}.");

            //Interface here as Well
            Console.WriteLine("Dino-Otter I am!");
            DinoOtter dinoOtter = new DinoOtter();

            Console.WriteLine($"Tails: {dinoOtter.Tail}.");
            Console.WriteLine($"Packs: {dinoOtter.Packs}.");
            Console.WriteLine($"Location: {dinoOtter.Location}.");
            Console.WriteLine($"Eyes: {dinoOtter.Eyes}.");
            Console.WriteLine($"Feeding Cost:${dinoOtter.FeedCost}.");
            Console.WriteLine($"Are they safe: {dinoOtter.Safe}.");
            Console.WriteLine($"Eat: {dinoOtter.Eat()}.");
            Console.WriteLine($"How many does it give birth per year: {dinoOtter.GiveBirth()}.");
            Console.WriteLine($"Interface => Fun Tricks: {dinoOtter.FunTricks}.");
            Console.WriteLine($"Interface => Loves Humans: {dinoOtter.Splash()}.");
            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            // make animals
            Skunk   skunk   = new Skunk();
            Weasel  weasel  = new Weasel();
            Bear    bear    = new Bear();
            Lion    lion    = new Lion();
            Wolf    wolf    = new Wolf();
            Narwhal narwhal = new Narwhal();
            Dolphin dolphin = new Dolphin();
            Orca    orca    = new Orca();

            // make dinner
            IAmDinner rat      = new OtherEdibleCritters();
            IAmDinner mole     = new OtherEdibleCritters();
            IAmDinner guppy    = new OtherEdibleCritters();
            IAmDinner salmon   = new OtherEdibleCritters();
            IAmDinner tuna     = new OtherEdibleCritters();
            IAmDinner sturgeon = new OtherEdibleCritters();
            IAmDinner bass     = new OtherEdibleCritters();

            // setting the stage
            Console.WriteLine("Chaos at the zoo!  All of the enclosures have been torn down by angry environmentalists, and the animals are out of control!");

            // skunk eats mole and births 3 babies
            Console.WriteLine("");
            skunk.Eat(mole);
            skunk.GiveBirth(3);

            // weasel eats rat and births 6 babies
            Console.WriteLine("");
            weasel.Eat(rat);
            weasel.GiveBirth(6);

            // lion and wolf each feast at the newly stocked weasel buffet
            Console.WriteLine("");
            lion.Eat(weasel);
            wolf.Eat(weasel);

            // wolf is expecting, so she also eats a bass
            Console.WriteLine("");
            wolf.Eat(bass);
            wolf.GiveBirth(3);

            // lion also had some buns in the oven
            Console.WriteLine("");
            lion.GiveBirth(4);

            // bear went out for dinner, and then went home to have babies and a nap
            Console.WriteLine("");
            bear.Travel();
            bear.Eat(salmon);
            bear.Travel();
            bear.GiveBirth(1);

            // meanwhile, in the water, everyone had babies!
            Console.WriteLine("");
            narwhal.GiveBirth(1);
            orca.GiveBirth(1);
            dolphin.GiveBirth(1);

            // ...and got hungry
            Console.WriteLine("");
            narwhal.Eat(guppy);
            dolphin.Eat(sturgeon);
            orca.Eat(narwhal);
            orca.Eat(dolphin);

            Console.ReadLine();
        }
Пример #3
0
        public void OrcaTest2()
        {
            Orca testTwo = new Orca();

            Assert.Equal(2, testTwo.GiveBirth());
        }