Lab 13A: Battle Royale. If you've ever played video games as a kid (and/or as an adult), you'll be familiar with "HP" or "hit points," which is the amount of "life" a character has in the game. For this week's lab, you will write a program that models a game. You need to create two classes, an Enemy class and a Hero class, and they will be almost identical. Both classes must contain the following:
- Amount of "life" called "HP" as an integer type
- A Boolean to represent whether an object (the game character) is alive
- A method called takeDamage that takes in the damage received as a parameter. This value is subtracted from the object's "hit points" (HP). If the HP is <= 0, this method can also change the Boolean value (that represents whether a character is alive) from true to false.
- Add an appropriate constructor for each class.
In main, you need the following:
- Prompt the user for the number of enemies in the game and the amount of damage they do per attack.
- Prompt the user to enter the hero's starting HP and the amount of damage the hero does per attack. These values are integers.
- Create an array of Enemies of the size specified by the user. Initialize the HP of each enemy based on its cell/index number, which is 10 + (2 * index number) - (amount of accumulated damage i.e. 10, 12, 14, 15...).
- You need to use a do/while loop so that your program will simulate a series of "rounds" of a battle until there is a winner. Rounds will continue as long as 1) the hero is alive and 2) there is at least one enemy alive (hint: set the loop up first).
- For each round, you need to loop through the enemy array and inflict damage to each one. You also need to inflict the damage of each enemy on the hero. Remember, a fight between the enemy and hero only occurs if that enemy is still alive.
- After each round, you need to print out the status of the game, which includes 1) the number of enemies left, 2) the HP of each enemy, and 3) the HP of the hero.
- At the end of the game, you need to print out a winner.
Hint: For simplicity, you need to make a (static) method above main that takes in the array of enemies and returns the number of enemies that are alive. You also need a method that takes in the enemy array and prints out the HP. These methods will keep your main code organized. The sample output is shown below. User input is in bold.