Home / Expert Answers / Computer Science / java-the-trainer-class-a-trainer-is-also-given-a-name-upon-creation-otherwise-he-has-room-to-carry-pa762

(Solved): JAVA The Trainer class A trainer is also given a name upon creation. Otherwise, he has room to carry ...



JAVA

The Trainer class

A trainer is also given a name upon creation. Otherwise, he has room to carry six pocket monsters at a time. Store them in a suitable data structure.

The pocket monsters must be added to the trainer's inventory.

The receive() method is passed a pocket monster and adds it to the previously selected data structure selected before. Make sure that no more than six pocket monsters can be added at the same time.


Each trainer must be able to send his pocket monsters into battle. For this, write a send() method that randomly returns one of the pocket monsters. Overload this method so that it is also possible to choose the pocket monster based on its place in the trainer's inventory. Note: For both methods, be careful not to return an incapacitated pocket monster back.


Override the toString() method so that it returns the profile of all the trainer's pocket monsters.

 

PS:
PLEASE TEST THE ANSWER BEFOR POSTING IT



We have an Answer from Expert

View Expert Answer

Expert Answer


PocketMonster.java import java.util.*; public class PocketMonster { String name; int health; int damage_value; boolean incapacitated; PocketMonster(String name_, int health_, int damage_value_) { name = name_; he
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe