Write Two Subclasses of a Game Character
mediumQuestion 519A GameCharacter class is provided. Its attack() returns 1, the damage of a character with no special skill. Write two subclasses that each store one extra number and override attack() to use it.
Requirements:
1. Warrior extends GameCharacter. Its constructor takes a String name and an int strength. attack() returns strength * 2.
2. Mage extends GameCharacter. Its constructor takes a String name and an int mana. attack() returns mana + 5.
3. Each constructor passes name to the GameCharacter constructor with super(name) and stores its own number in a private field.
4. Keep Warrior as the public class. Mage stays without the word public, because a Java file may have only one public class.
Do not change the GameCharacter class. The tests put both kinds into a GameCharacter[] array and call attack() on each element.
Do NOT write a main method.
Expected output
Brak hits for 14 Zia hits for 17
= newline. The output ends with a newline, so print one after the last line.
Your output
Run your code to see the output here...