Question: Please do the following question using Java. Also please separate these into the separate classes (use Inheritance [extends...]): Vampire.java, Zombie.java, GeneralZod.java and finally MonsterTester.java. You

Please do the following question using Java. Also please separate these into the separate classes (use Inheritance [extends...]): Vampire.java, Zombie.java, GeneralZod.java and finally MonsterTester.java. You are also given the following abstract Monster.java class and a Hero.java class:

Monster.java

public abstract class Monster {

private int health; /** * Single-argument constructor * @param health The initial health of the monster. */ public Monster(int health) { this.health = health; } /** * Determine if the monster is dead (health

}

Hero.java

public class Hero { private final String name; private int health; /** * Single argument constructor. * @param name name of the hero. */ public Hero(String name){ this.name = name; //arbitrary settings. A more argumented constructor could help here. health = 100; } /** * Damage inflicted by an opponent. * @param damage amount of health to be reduced. */ public void takeDamage(int damage){ health -= damage; } /** * Amount of damage to inflict on an opponent. * @return damage inflicted on opponent. */ public int dealDamage(){ return (int)((Math.random() * 10) + 5); } /** * Amount of health * @return health */ public int getHealth(){ return health; } /** * Name of hero * @return name */ public String getName() { return name; } /** * Determine if Hero is dead. * @return true if dead, otherwise false. */ public boolean isDead(){return health

}

Given those, you have the following questions:

Please do the following question using Java. Also please separate these into

NOTE:****VERY IMPORTANT****Please use the dealDamage(); method from Hero.java, and as well as toStrings();. Additionally the random health of each monster should be in its own class. For example, the health of the Zombie, should be in Zombie.java, the health of the Vampire should be in Vampire.java and so on. This is done so that when you create an array of object like: monsters[i] = new Vampire(); it should automatically have the Vampire's health from its class. Also edit the default constructor for Hero and finally use lots of display lines and spaces in the tester for final output. This is the tester:

the separate classes (use Inheritance [extends...]): Vampire.java, Zombie.java, GeneralZod.java and finally MonsterTester.java.

****NOTE VERY IMPORTANT FOR TESTER***. IN THE TESTER MAKE SURE THAT WHEN CREATING RANDOM 5 MONSTERS, ONLY ONE GENERALZOD IS CREATED

AND HE APPEARS AS THE LAST MONSTER CREATED!!!!.

2. A) (Vampire.java, Zombie.java, GeneralZod.java, MonterTester,java 25 marks) (15 marks) Consider the abstract Monster class that is given to you in the project file. This class defines the essential characteristics of Monsters that might be used in a game. Your jobs is to create three specific Monster classes-as described below - and to follow the standard rules of inheritance in doing so (override methods that need to be overridden, implement methods that need to be implemented, do NOT override or implement methods that are adequately implemented in the superclass, etc., etc.) Vampire: A vampire starts off with between 8 and 12 health. They aren't very healthy and they do only between 6 and 9 damage per turn. Zombie: Zombies are a bit tougher so they start off with health between 11 and 16. They also do a bit more damage - between 8 and 14 per turn. General Zod: General Zod is kind of a bad guy- he means well, but still... Thanks to the Earth's yellow sun his starting health is between 25 and 30 and he does a damaging 12 to 20 per turn. Make sure that each Monster has a toString) method for easy display

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!