Question: In this lab, you will work with two java files: Pokemon.java - defines the Pokemon class PokemonField.java - contains main() method, where you may create

In this lab, you will work with two java files:

Pokemon.java - defines the Pokemon class

PokemonField.java - contains main() method, where you may create objects of the Pokemon class.

Note: In the Pokemon game, hp is a term that means hit points (or life). This value decreases when the Pokemon is attacked. When this value reaches 0, the Pokemon loses the battle. The field maxHp refers to the number of hit points the Pokemon has at the beginning of the battle.The field hitPoints refers to the current amount of hitPoints remaining for the Pokemon. At the beginning of the battle, these two values will be the same, but hitPoints will decrease over time when the Pokemon is attacked. The field attackPoints refers to the amount of damage that the Pokemon creates when it attacks another Pokemon.

Complete the Pokemon class with the following specifications:

(1) add the following four private fields

* String name * int maxHp * int hitPoints * int attackPoints 

(2) add a constructor, which takes three parameters, the first one is used to initialize name, the second one is used to initialize both maxHP and hitPoints, and the third one is used to initialize attackPoints.

(3) add public methods (mutators): setHitPoints, setAttackPoints

(4) add public methods (accessors): getName, getHitPoints, getAttackPoints

Complete the fight method in PokemonField.java

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!