Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions