Beispiel #1
0
        static void Main(string[] args)
        {
            Platypus ornitorinc           = new Platypus("Ornitorinc", 20, 4, 2);
            WildDuck rata                 = new WildDuck("Donald", 20, 6, 35, 500);
            Piranha  piranha              = new Piranha("Nemo", 25, 250);
            AhkistrodonPiscivorus mocasin = new AhkistrodonPiscivorus("Boa", 20, 15, "frogs");
            Ladybug gargarita             = new Ladybug("Gargarita", 0.5, 15, Ladybug.LadybugColor.Black, 12);

            Animal[] animals = { ornitorinc, rata, piranha, mocasin, gargarita };
            Console.WriteLine("\t\tInitialy\n");
            foreach (Animal a in animals)
            {
                Console.WriteLine($"{a}\n");
            }

            Console.WriteLine("Press enter to continue");
            Console.ReadLine();

            ornitorinc.MakeAnEgg();
            ornitorinc.MakeAnEgg();
            ornitorinc.BreakAnEgg();
            ornitorinc.Hatch();

            rata.GainWeight(45);
            piranha.Grow(10);
            mocasin.AddFavouriteFood(" trout triton");
            mocasin.RemoveFavouriteFood("frogs");

            Console.WriteLine("\t\tAfter the changes\n");
            foreach (Animal a in animals)
            {
                Console.WriteLine($"{a}\n");
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Eagle eagle = new Eagle("Val", AnimalCategories.bird);

            Console.WriteLine(eagle);
            eagle.Swim();
            eagle.Fly();
            eagle.Move();
            eagle.Walk();

            Console.WriteLine("--------------------------------------------");

            Platypus platypus = new Platypus("Orni", AnimalCategories.mammal);

            Console.WriteLine(platypus);
            platypus.Move();
            platypus.Swim();
            platypus.Walk();

            Console.WriteLine("---------------------------------------------");


            WildDuck wildDuck = new WildDuck("Donald", AnimalCategories.bird);

            Console.WriteLine(wildDuck);
            wildDuck.Fly();
            wildDuck.Move();
            wildDuck.Swim();
            wildDuck.Walk();


            Console.WriteLine("----------------------------------------------");

            Crocodile aligator = new Crocodile("Aligator", AnimalCategories.reptile);

            Console.WriteLine(aligator);
            aligator.Crawl();
            aligator.Move();
            aligator.Swim();
            aligator.Walk();
        }