OR JAVA Implement the following classes / abstract classes below. Monster abstract class which has health point (int), damage point (int), name (String), resistance rate (int) fields and following methods. – A constructor that takes the name as a parameter and sets the health and damage points to random numbers between 10 and 100. – isDead() method which returns true if hp is less than or equal to 0, and false otherwise. – fight() method which prints the applied damage after resistance (see below). WaterMonster class whose resistance rate is %20. For example, if the damage of an instance of this class is 100, the fight method should print 80. FireMonster class whose resistance rate is %10. SlicingMonster class whose resistance rate is %5.
FOR JAVA
Implement the following classes / abstract classes below.
-
Monster abstract class which has health point (int), damage point (int), name (String), resistance rate (int) fields and following methods.
-
– A constructor that takes the name as a parameter and sets the health and damage points to random numbers between 10 and 100.
-
– isDead() method which returns true if hp is less than or equal to 0, and false otherwise.
-
– fight() method which prints the applied damage after resistance (see below).
-
-
WaterMonster class whose resistance rate is %20. For example, if the damage of an instance of this class is 100, the fight method should print 80.
-
FireMonster class whose resistance rate is %10.
-
SlicingMonster class whose resistance rate is %5.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps