logo CodeStepByStep logo

Rabbit

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

Define a Critter class named Rabbit with the following behavior:

constructor public Rabbit()
color dark gray (Color.DARK_GRAY)
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:
first north twice, then south twice, then east twice, and repeat
toString "V"
rabbit
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.