For this question, you will implement a method called hopManyAndTurn()
that could be placed in a Jeroo
subclass. This method takes in two...
X924: Jeroo hopManyAndTurn()
For this question, you will implement a method called hopManyAndTurn()
that could be placed in a Jeroo
subclass.
This method takes in two parameters, an int
value called hops
that indicates how many hops to make, and a CompassDirection
(NORTH
, SOUTH
, EAST
, or WEST
) the jeroo should turn towards.
Using these parameters, implement the method so the jeroo first hops the given distance (it moves hops
number of times), then use a while loop to turn the jeroo to face the compass direction.
Remember that because this method would go inside a Jeroo
subclass, you can use this
to refer to the jeroo itself.
Your Answer:
Feedback
Your feedback will appear here when you check your answer.