/* * public class Bird * { * public string Name { get; private set; } * public string Color { get; private set; } * * public Bird(string name, string color) * { * Name = name; * Color = color; * } * * public void Speak() * { * Console.WriteLine($"My name is {Name} and I am a {Color} bird."); * } * * public void Fly() * { * Console.WriteLine($"I'm {Name} and I can fly high in the blue sky!"); * } * } * * public class Pigeon : Bird * { * //The Pigeon constructor calls the base class Bird constructor * //The name and color parameters are passed to the Bird constructor * public Pigeon(string name, string color) : base(name, color) * { * } * * public void EatPizza() * { * Console.WriteLine("Delicious pizza!"); * } * public void Sleep(string condition) * { * string Condition = condition; * Console.WriteLine($"im a {Condition} sleepy bird :)"); * } * * } * */ static void Main(string[] args) { Pigeon pippa = new Pigeon("Pippa", "Grey"); pippa.Speak(); pippa.Fly(); pippa.EatPizza(); pippa.Spin(); pippa.DoTheCaterpillar(); pippa.Jump(); Penguin pingu = new Penguin("Pingu", "Black & White"); pingu.Speak(); pingu.Fly(); pingu.Spin(); Parrot rio = new Parrot("rio", "blue"); rio.Speak(); rio.Spin(); pingu.Jump(); #if DEBUG Console.WriteLine("\nPress enter to close..."); Console.ReadLine(); #endif }
static void Main(string[] args) { Lion newLion = new Lion(); newLion.Name = ("Mufasa"); Console.WriteLine("This lion is named " + newLion.Name); Console.WriteLine("This lion has " + newLion.NumberLegs + " number of legs."); Console.WriteLine("This lion has a tail. (T/F)? " + newLion.Tail); Console.WriteLine("This lion lands on all fours. (T/F)? " + newLion.allFours); Console.WriteLine("This lion has fur. (T/F)? " + newLion.Fur); newLion.King = true; Console.WriteLine("This lion is the king of the jungle. (T/F)? " + newLion.King); newLion.Mane = true; Console.WriteLine("This lion has a mane. (T/F)? " + newLion.Mane); Console.WriteLine(" "); Tiger newTiger = new Tiger(); newTiger.Name = ("Eustace"); Console.WriteLine("This tiger is named " + newTiger.Name); Console.WriteLine("This tiger has " + newTiger.NumberLegs + " number of legs."); Console.WriteLine("This tiger has a tail. (T/F)? " + newTiger.Tail); Console.WriteLine("This tiger lands on all fours. (T/F)? " + newTiger.allFours); Console.WriteLine("This tiger has fur. (T/F)? " + newTiger.Fur); Console.WriteLine("This tiger has stripes. (T/F)? " + newTiger.Stripes); newTiger.Sleep = false; Console.WriteLine("This tiger sleeps standing up. (T/F)? " + newTiger.Sleep); Console.WriteLine(" "); Crocodile newCrocodile = new Crocodile(); newCrocodile.Name = ("Dundee"); Console.WriteLine("This crocodile is named " + newCrocodile.Name); Console.WriteLine("This crocodile has " + newCrocodile.NumberLegs + " number of legs."); Console.WriteLine("This crocodile has a tail. (T/F)? " + newCrocodile.Tail); Console.WriteLine("This crocodile has scales. (T/F)? " + newCrocodile.HasScales); Console.WriteLine("This crocodile swims. (T/F)? " + newCrocodile.doesSwim); Console.WriteLine("This crocodile is green. (T/F)? " + newCrocodile.Green); newCrocodile.Land = false; Console.WriteLine("This crocodile goes on land. (T/F)? " + newCrocodile.Land); Console.WriteLine(" "); Marlin newMarlin = new Marlin(); newMarlin.Name = ("Nemo"); Console.WriteLine("This Marlin is named " + newMarlin.Name); Console.WriteLine("This Marlin has " + newMarlin.NumberLegs + " number of legs."); Console.WriteLine("This Marlin has a tail. (T/F)? " + newMarlin.Tail); Console.WriteLine("This Marlin has scales. (T/F)? " + newMarlin.HasScales); Console.WriteLine("This Marlin swims. (T/F)? " + newMarlin.doesSwim); Console.WriteLine("This Marlin has a sword nose. (T/F)? " + newMarlin.Swordnose); Console.WriteLine("This Marlin has fins (T/F)? " + newMarlin.Fins); Console.WriteLine(" "); Penguin newPenguin = new Penguin(); newPenguin.Name = ("Popper"); Console.WriteLine("This Penguin is named " + newPenguin.Name); Console.WriteLine("This Penguin has " + newPenguin.NumberLegs + " number of legs."); Console.WriteLine("This Penguin has a tail. (T/F)? " + newPenguin.Tail); Console.WriteLine("This Penguin has a beak. (T/F)? " + newPenguin.Beak); Console.WriteLine("This Penguin lays eggs. (T/F)? " + newPenguin.Eggs); Console.WriteLine("This Penguin does not fly. (T/F)? " + newPenguin.Flys); Console.WriteLine("This Penguin lives in cold weather. (T/F)? " + newPenguin.weather); Console.WriteLine(" "); Eagle newEagle = new Eagle(); newEagle.Name = ("Freedom"); Console.WriteLine("This Eagle is named " + newEagle.Name); Console.WriteLine("This Eagle has " + newEagle.NumberLegs + " number of legs."); Console.WriteLine("This Eagle has a tail. (T/F)? " + newEagle.Tail); Console.WriteLine("This Eagle has a beak. (T/F)? " + newEagle.Beak); Console.WriteLine("This Eagle lays eggs. (T/F)? " + newEagle.Eggs); Console.WriteLine("This Eagle does not fly. (T/F)? " + newEagle.flys); Console.WriteLine("This Eagle is naturally bald. (T/F)? " + newEagle.bald); Console.WriteLine(" "); Console.ReadLine(); }