Esempio n. 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();
        }
    public static void Main()
    {
        Octopus o = new Octopus();

        if (o.isHungry())
        {
            Console.WriteLine("The octopus is hungry!\n");
        }
        else
        {
            Console.WriteLine("The octopus isn't hungry!\n");
        }

        o.Digest(75);
        Console.WriteLine("The octopus is {0}% hungry", o.HungerPercent);
        Console.WriteLine("Feeding the octopus with an int...");
        o.Eat(10);
        Console.WriteLine("The octopus is {0}% hungry", o.HungerPercent);
        Console.WriteLine("Feeding the octopus with a string...");
        o.Eat("10");
        Console.WriteLine("The octopus is {0}% hungry", o.HungerPercent);
    }
    public static void Main()
    {
        Octopus o = new Octopus();

        o.name = "Fred";

        Console.WriteLine("The octopus {0} hungry!\n", o.isHungry() ? "is" : "isn't");

        Console.WriteLine("Digesting 75 food!");
        o.Digest(75);
        Console.WriteLine("The octopus is {0}% hungry\n", o.HungerPercent);

        Console.WriteLine("Feeding the octopus with an int...");
        o.Eat(10);
        Console.WriteLine("The octopus is {0}% hungry\n", o.HungerPercent);

        Console.WriteLine("Feeding the octopus with a string...");
        o.Eat("10");
        Console.WriteLine("The octopus is {0}% hungry\n", o.HungerPercent);

        Console.WriteLine("The octopus is named: {0}", o.name);
        Console.WriteLine("The octopus is age: {0}", o.age);
        Console.WriteLine("The octopus has {0} legs and {1} eyes!", Octopus.legs, Octopus.eyes);
    }