コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter q to quit!");

            var zoo = new Zoo();

            while (true)
            {
                Console.WriteLine();
                Console.WriteLine("Enter Animal Type: ");
                Console.WriteLine("1. Lion");
                Console.WriteLine("2. Tiger");
                Console.WriteLine("3. Zebra");

                Console.Write("Type (number): ");
                var type = Console.ReadLine();
                if (type == "q")
                {
                    break;
                }

                Animal animal = null;
                switch (type)
                {
                case "1":
                    animal = new Lion();
                    break;

                case "2":
                    animal = new Tiger();
                    break;

                case "3":
                    animal = new Zebra();
                    break;

                default:
                    Console.WriteLine("Not a valid animal type!");
                    break;
                }

                if (animal != null)
                {
                    Console.WriteLine();
                    Console.WriteLine($"Feed the : {animal.Type()}.");
                    animal.WrongFoodProvided += OnWrongFoodProvided;
                    FeedAnimal(animal);
                    zoo.AddAnimal(animal);
                }
            }

            Console.WriteLine($"Total Expenses for all animals: {zoo.TotalExpenses()}");
            var mostExpensive = zoo.MostExpensive();

            Console.WriteLine($"Most expensive animal to keep is: {mostExpensive.Type()}");
            Console.WriteLine($"It eats: {zoo.CostByAnimal(mostExpensive)}");
        }
コード例 #2
0
 private void Start()
 {
     henk        = Instantiate(lion, transform).GetComponent <Lion>();
     henk.name   = "henk";
     elsa        = Instantiate(hippo, transform).GetComponent <Hippo>();
     elsa.name   = "elsa";
     dora        = Instantiate(pig, transform).GetComponent <Pig>();
     dora.name   = "dora";
     wally       = Instantiate(tiger, transform).GetComponent <Tiger>();
     wally.name  = "wally";
     marty       = Instantiate(zebra, transform).GetComponent <Zebra>();
     marty.name  = "marty";
     steven      = Instantiate(captainAmerica, transform).GetComponent <CaptainAmerica>();
     steven.name = "steven";
     logan       = Instantiate(wolverine, transform).GetComponent <Wolverine>();
     logan.name  = "logan";
 }
コード例 #3
0
        /// <summary>
        /// Instantiates every animal and adds them to the scene.
        /// </summary>
        private void Start()
        {
            Lion   henk   = Instantiate(lion, transform).GetComponent <Lion>();
            Hippo  elsa   = Instantiate(hippo, transform).GetComponent <Hippo>();
            Pig    dora   = Instantiate(pig, transform).GetComponent <Pig>();
            Tiger  wally  = Instantiate(tiger, transform).GetComponent <Tiger>();
            Zebra  marty  = Instantiate(zebra, transform).GetComponent <Zebra>();
            Monkey ceaser = Instantiate(monkey, transform).GetComponent <Monkey>();
            Toucan duif   = Instantiate(toucan, transform).GetComponent <Toucan>();

            animals.Add(henk);
            animals.Add(elsa);
            animals.Add(dora);
            animals.Add(wally);
            animals.Add(marty);
            animals.Add(ceaser);
            animals.Add(duif);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: LucileGamond/Zoo
        static void Main(string[] args)
        {
            Chien monChien1 = new Chien("Coco", 12);

            monChien1.sePresenter();
            monChien1.Crier();
            monChien1.Manger();

            Lion monLion1 = new Lion("TAB", 6);

            monLion1.sePresenter();
            monLion1.Crier();
            monLion1.SeDeplacer();

            Enclos enclosLion = new Enclos(6);

            enclosLion.Put(monLion1);
            Console.ReadLine();
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: CClemensJr/Zoo
        private static void WelcomeToTheZoo()
        {
            Console.WriteLine("Welcome to my zoo!");



            Console.Write("We have a Lion that:");

            Lion lion = new Lion();

            Console.WriteLine(lion.Scratch());


            Console.Write("We have a Tiger that:");

            Tiger tiger = new Tiger();

            Console.WriteLine(tiger.Hunt());


            Console.Write("We have a Bear that:");

            Bear bear = new Bear();

            Console.WriteLine(bear.Sleep());


            Console.Write("We have a Crocodile that:");

            Crocodile crocodile = new Crocodile();

            Console.WriteLine(crocodile.Move());


            Console.Write("And a Velociraptor that:");

            Velociraptor velociraptor = new Velociraptor();

            Console.WriteLine(velociraptor.Move());

            Console.WriteLine("This is probably the best zoo ever");
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Tiger   tom     = new Tiger();
            Lion    leon    = new Lion();
            Chicken chester = new Chicken();
            Whale   whale   = new Whale();
            SeaLion seaLion = new SeaLion();
            Parrot  parrot  = new Parrot();

            tom.Speak();
            tom.Play();
            Console.Write("\n");
            leon.Speak();
            leon.Play();
            Console.Write("\n");
            chester.Speak();
            chester.Eat();
            chester.Fly();
            chester.Land();
            chester.Swim();
            chester.Stop();
            Console.Write("\n");
            whale.Speak();
            whale.Play();
            whale.Swim();
            Console.Write("\n");
            seaLion.Speak();
            seaLion.Play();
            whale.Swim();
            Console.Write("\n");
            parrot.Speak();
            parrot.Fly();
            parrot.Land();
            parrot.Eat();
            Console.ReadKey();
            Console.Write("\n");
        }
コード例 #7
0
        private void Start()
        {
            Lion henk = Instantiate(lion, transform).GetComponent <Lion>();

            henk.Name = "henk";
            Hippo elsa = Instantiate(hippo, transform).GetComponent <Hippo>();

            elsa.Name = "elsa";
            Pig dora = Instantiate(pig, transform).GetComponent <Pig>();

            dora.Name = "dora";
            Tiger wally = Instantiate(tiger, transform).GetComponent <Tiger>();

            wally.Name = "wally";
            Zebra marty = Instantiate(zebra, transform).GetComponent <Zebra>();

            marty.Name = "marty";
            Squirrel stamper = Instantiate(rabbit, transform).GetComponent <Squirrel>();

            stamper.Name = "stamper";
            Wolf kiba = Instantiate(wolf, transform).GetComponent <Wolf>();

            kiba.Name = "kiba";
        }
コード例 #8
0
        static void Main(string[] args)
        {
            Fish     newFish    = new Fish("Nemo", false, 4);
            Crow     newCrow    = new Crow("Poe", 14, "black");
            Owl      newOwl     = new Owl("Hedwig", 24);
            Leopard  newLeopard = new Leopard("Treecat", 11, true);
            Lion     newLion    = new Lion("Alex", 16);
            Hound    newHound   = new Hound("Sam", 10);
            Labrador newLab     = new Labrador("Bo", 12);

            Console.WriteLine(newFish.Swim());

            Console.WriteLine(newCrow.Fly());

            Console.WriteLine(newOwl.Sleep());

            Console.WriteLine(newLeopard.PetHuman());

            Console.WriteLine(newLion.Purr());

            Console.WriteLine(newHound.Poop());

            Console.WriteLine(newLab.Bark());
        }
コード例 #9
0
        private void Start()
        {
            Lion henk = Instantiate(lion, transform).GetComponent <Lion>();

            henk.name = "henk";
            Hippo elsa = Instantiate(hippo, transform).GetComponent <Hippo>();

            elsa.name = "elsa";
            Pig dora = Instantiate(pig, transform).GetComponent <Pig>();

            dora.name = "dora";
            Tiger wally = Instantiate(tiger, transform).GetComponent <Tiger>();

            wally.name = "wally";
            Zebra marty = Instantiate(zebra, transform).GetComponent <Zebra>();

            marty.name = "marty";
            Tyler1 tyler1 = Instantiate(fourHead, transform).GetComponent <Tyler1>();

            tyler1.name = "tyler1";
            Mike mike = Instantiate(bruh, transform).GetComponent <Mike>();

            mike.name = "mike";
        }
コード例 #10
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();
        }
コード例 #11
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hipopótamo");
            Hippo hippo = new Hippo();

            hippo.Name = "Hipopótamo";
            hippo.Food = "50k de grama";
            hippo.MakeNoise();
            hippo.Eat();
            hippo.Sleep();
            hippo.Roam();

            SaltarLinhas();

            Console.WriteLine("Felinos");

            SaltarLinhas();
            Console.WriteLine("Tigre");
            Tiger tiger = new Tiger();

            tiger.Name = "Tigre";
            tiger.Food = "30k de carne";
            tiger.MakeNoise();
            tiger.Eat();
            tiger.Sleep();
            tiger.Roam();

            SaltarLinhas();
            Console.WriteLine("Leão");
            Lion lion = new Lion();

            lion.Name = "Leão";
            lion.Food = "30k de carne";
            lion.MakeNoise();
            lion.Eat();
            lion.Sleep();
            lion.Roam();

            SaltarLinhas();
            Console.WriteLine("Gato");
            Cat cat = new Cat();

            cat.Name = "Gato";
            cat.Food = "5k de carne";
            cat.MakeNoise();
            cat.Eat();
            cat.Sleep();
            cat.Roam();

            SaltarLinhas();

            Console.WriteLine("Caninos");

            SaltarLinhas();
            Console.WriteLine("Cachorro");
            Dog dog = new Dog();

            dog.Name = "Cachorro";
            dog.Food = "10k de ração";
            dog.MakeNoise();
            dog.Eat();
            dog.Sleep();
            dog.Roam();

            SaltarLinhas();
            Console.WriteLine("Lobo");
            Wolf wolf = new Wolf();

            wolf.Name = "Cachorro";
            wolf.Food = "10k de ração";
            wolf.MakeNoise();
            wolf.Eat();
            wolf.Sleep();
            wolf.Roam();

            Console.ReadKey();
        }