Question: 24. Consider the following simplified abstract Monster class for use in a game public abstract class Monster private int health public Monster (int health) this.

 24. Consider the following simplified abstract Monster class for use in

a game public abstract class Monster private int health public Monster (int

health) this. health health public boolean is Dead return health 0; public

24. Consider the following simplified abstract Monster class for use in a game public abstract class Monster private int health public Monster (int health) this. health health public boolean is Dead return health 0; public void take Damage (int damage) health damage; public int get Health return health; public abstract int dealDamage public string toString return Monster health "J "i a) (10 marks) There are 5 inheritance related syntax or logic errors in the Zombie subclass below. Identify these errors and suggest possible corrections for each. (Line numbers are there for your reference only and are not errors 1. public class zombie inherits Monster 2. //repeat parent data field for clarity and add new data field 3. rivate int health 4. private int numberofArms 5. public Zombie (int h) health numberof Arms (int) (Math.random 3) 9. //add new method for new data field 10 public int getNumberofArms return numberofArms; 11 //add a new method for special attack returns damage amount 12 public int chewEnemeny return 5; 13 No need to override takeDamage isDead, dealDamage toString or get Health 14 //as they are already in the super class 15

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!