Write a superclass Fighter (protected name, health, power; attack(int round) returns power; takeDamage(int damage) never lets health go below 0; toString() → Ana[35]) and two subclasses:
Warrior(name, health, power, armor)overridestakeDamage: the armor absorbs part of each hit, but a hit always costs at least 1 (super.takeDamage(Math.max(1, damage - armor)));Mage(name, health, power)overridesattack: every third round the damage is tripled (3 * super.attack(round)).
Arena.main reads two fighters (warrior NAME HEALTH POWER ARMOR, mage NAME HEALTH POWER or fighter NAME HEALTH POWER). Each round the first fighter strikes, then the second one if still alive; print both after every round. Stop when one falls or after 20 rounds (Draw after 20 rounds).
For the input
warrior Ana 40 6 2 mage Bo 30 5
the program prints
Round 1: Ana[37] Bo[24]
Round 2: Ana[34] Bo[18]
Round 3: Ana[21] Bo[12]
Round 4: Ana[18] Bo[6]
Round 5: Ana[18] Bo[0]
Ana wins in round 5