static void Main(string[] args) { person p = new person("William", "Bill"); person q = new person("Kathryn", "Kate"); person r = new person("Alexandria", "Lexi"); SuperHero sp = new SuperHero("super strength", "Wade Turner", "Mr. Incredible"); SuperHero hr = new SuperHero("super speed", "Alana Norton", "Nelvana of the North"); SuperHero tv = new SuperHero("super bravery", "John Aman", "Amazing-Man"); Villain v = new Villain("Batman", "The Joker"); Villain a = new Villain("The Doctor", "The Master"); Villain b = new Villain("Sherlock Holmes", "Professor Moriarty"); p.PrintGreeting(); q.PrintGreeting(); r.PrintGreeting(); Console.WriteLine(); sp.PrintGreeting(); hr.PrintGreeting(); tv.PrintGreeting(); Console.WriteLine(); v.PrintGreeting(); a.PrintGreeting(); b.PrintGreeting(); Console.Read(); }
// Create a few humans, superheroes, and villains // Add them to a list // Loop through them and print each one's name followed by the greeting public static void Main(String[] args) { Person civilian = new Person("William", "Bill"); SuperHero hero = new SuperHero("Mr. Incredible", "super strength", "Wade Turner"); Villain villain = new Villain("The Joker", "Batman"); Console.WriteLine($"{civilian.ToString()}: {civilian.PrintGreeting()}"); // return William: Hi, my name is William, you can call me Bill. Console.WriteLine($"{hero.ToString()}: {hero.PrintGreeting()}"); // return Mr. Incredible: I am Wade Turner. When I am Mr. Incredible, my super power is super strength! Console.WriteLine($"{villain.ToString()}: {villain.PrintGreeting()}"); // return Joker: I am The Joker! Have you seen Batman? Console.Read(); }
public static void Main(string[] args) { Person a = new Person("William", "Bill"); Person b = new Person("Robert", "Bobby"); Person c = new Person("Lexi", "Alexis"); SuperHero e = new SuperHero("Wade Turner", "Super Strength", "Mr.Incredible"); SuperHero f = new SuperHero("Bruce Wayne", "Super Intelligent", "Batman"); Villain g = new Villain("Joker", "Batman"); Villain h = new Villain("Doc-oc", "Spiderman"); a.PrintGreeting(); b.PrintGreeting(); c.PrintGreeting(); Console.WriteLine(); e.PrintGreeting(); f.PrintGreeting(); Console.WriteLine(); g.PrintGreeting(); h.PrintGreeting(); Console.ReadLine(); }