Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hero class down below: Please write in C# console application. Create a Console Application named YourLastName_PA3. For this project, you are to download the Hero.cs

image text in transcribed

Hero class down below:

image text in transcribed

Please write in C# console application.

Create a Console Application named YourLastName_PA3. For this project, you are to download the Hero.cs class file from D2L and add the file to your project. You are then going to add one method to the Hero class file, and then add 2 more classes to your project which will inherit from the Hero class. Finally, in Main) you will implement a small program to test your class files. Step 1: Download the Hero.cs class file from D2L. Add a method named AnnounceSelf() that prints to the console the Hero's Title and Health Points. This method should be created so that it can be overridden in derived classes. Only one method should be added, and no other part of the class should be modified. Step 2: Add two more classes to your project. Both of these classes will inherit from the Hero class. Each class should have an "Is-A" relationship to the Hero class. For example, you could create a Mage class, or Warrior class, or an Accountant class, or a Programmer class (Programmers are the Heroes of our time!) A) For each of the two classes, you should add 1 unique field/Property for that class B) For each of the two classes, you should override the inherited AnnounceSelf() method so that it prints the Hero's Title and the field/property value you added for that class C) For each of the two classes, implement any components necessary for the Hero inheritance to be valid Example: to my project I add a Mage class in which I add a MagicPoints field/Property. I modify the AnnounceSelf() method to output the text "I am a with <magicpoints> Magic Points!". I then add a Warrior class, which I define a Strength field/Property for. I modify the AnnounceSelf() method to output the text "This <title> has <strength> strength!". Step 3: In Main(), create a List object that holds type 'Hero' objects. To this list, add two instances of each of your two classes, and initialize each instance in a unique way. Then, loop through each Hero in the list and call its AnnounceSelf() method Example output might look something like: I am a Mage with 35 Magic Points! This Warrior has 100 strength! I am a Dumbledore with 120 Magic Points! This Barbarian has 250 strength</strength>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions

Question

What is a core competency?

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago