Question: (Java) This is only part of the Java problem but I'm trying to find the best way to start the code off. I'm not looking

(Java) This is only part of the Java problem but I'm trying to find the best way to start the code off. I'm not looking for the full code just the first parts of it to get a better understanding of how to begin. Still a beginner to OOP so explanations/comments are appreciated if possible.

1) Write a class CuteCreature, such that each CuteCreature object has the following instance variables:

Species - a string indicating the type of creature (such as Bowlbasore, Squaretell, or Peekashoe)

Level a positive integer indicating how powerful the creature is Current hit points a non-negative integer indicating how much damage the creature can take before being incapacitated

Maximum hit points - a positive integer indicating the highest possible value of current hit points Attack rating a non-negative integer indicating how effective this creature is at attacking another creature

Defense rating - an integer indicating how effective this creature is at resisting an attack from another creature. Note that unlike attack rating, defense rating can be negative (if affected by a debuff, for example).

Experience points a non-negative integer indicating the creatures cumulative experience. Creatures use experience points to determine when to level up and become more powerful.

Experience value a non-negative integer indicating how many experience points this creature is worth when defeated by another creature

isSpecial a boolean variable that determines whether this creature is considered special. Internally, special creatures are exactly the same as non-special creatures. However, they have a slightly different appearance and are somehow very highly prized by the players of your game.

2) Add a constructor with parameters for species, maximum hit points, attack rating, defense rating, experience value, and special status. A newly created CuteCreature should have a level of 1, current hit points equal to the maximum hit points, and zero experience points.

3) Add the following:

private void levelUp()

This method makes the CuteCreature level up. Leveling up increases the creatures level by 1, in addition to the following changes:

If the new level is between 2-9 (inclusive): Maximum hit points increase by 7, attack and defense ratings increase by 3

If the new level is 10 or over: Maximum hit points increase by 2, attack and defense ratings increase by 1

For all level ups: Experience value increases by 15

For all level ups: The creature is fully healed (i.e., the current hit points is set to the maximum hit points)

The levelUp method should display some text when called, to indicate that the creature is leveling up.

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!