logo CodeStepByStep logo

WhiteRabbit

("Critter" classes come from Marty Stepp's "Critters" homework assignment. See "Critters spec" link above for more information.)

Define a Critter class named WhiteRabbit with the following behavior:

constructor public WhiteRabbit()
color white
eating behavior alternates between true and false (true, false, true, ...)
fighting behavior if opponent is a Bird or Vulture, then scratch; otherwise, roar
movement behavior hops in an L-shaped pattern, in cycles of 5:
first north 5x, then south 5x, then east 5x, and repeat
toString "V"
Inheritance: Write a Java class using inheritance.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.