Lets create a program where you can own pets that have a super power. A pet can

Question:

Let’s create a program where you can own pets that have a super power. A pet can have up to three attack moves, and each move has a limited number of times you can use and how powerful each move is. A pet has a maximum health of 100, but decreases based on the attack used against them. 

Create two classes: 

image text in transcribed

These two class templates should have getters and setters for the fields. 

Create another class called Game with a main method. This is where you will create the opponent pet and your pet objects. Have the pet attack each other one at a time (a turn based system) until one of the pets' health reaches 0. The pets should use all three attack moves during the game. 

If you don’t want to hardcode when to use each attack, you can use the following code to generate a random number between 1~3: 

image text in transcribed

Make sure to have the import at the beginning of the file, before we declare our class. 

If the random number is 1, then use attack 1. If it’s 2, then use attack 2. If it’s 3, then use attack 3. 

The Game class is really free for all, so you can do whatever you want with it!

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: