Question: Design and implement a class called Cat, which represents a cat climbing a vertical utility pole. The cat can only climb for one unit of
Design and implement a class called Cat, which represents a cat climbing a vertical utility pole. The cat can only climb for one unit of distance at a time. The direction in which it is climbing can be either up or down. The cat can decide to change direction ie if it was climbing up then it will now be climbing down; and viceversa Cat requires a toString method to return both the current position and the direction climbing to the driver so it can be output. No set or get methods are required for this question.
For your design, create a UML Class diagram similar to Figure on page of the textbook. Note that you need to include the constructor in the methods section if you code a constructor.
Hints: Remember that a positive vertical number line has a zero position at the bottom with numbers increasing positive as you move up Obviously, a cat cannot climb below or it would be digging under the ground.
Write an interactive test driver that instantiates a Cat, then allows the user to manipulate it with simple commands like Output to see the position and direction Climb, Reverse, Exit single letters work just fine. All output must be via the driver not methods within Cat. You should use this driver to create screenshot exhibits for a number of scenarios eg output original state, climb a few times, output, climb a few more times, output, reverse, output, climb, output, reverse, output, etc. in java
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
