Adding and Eating Worms. Mrs. C. Furman August 23, 2010. Let’s add a Worm Class. What class should we extend to add a Worm? Worm is-a Animal Select New Subclass from the Animal menu. Click here. Setting up the new Subclass. Enter the name as Worm
Adding and Eating Worms
Mrs. C. Furman
August 23, 2010
* Check whether we have found a worm
* If we have found a worm, we eat it.
* If we haven’t, we do nothing.
* PostCondition: After this method has
* been executed worms near the crab
* have been removed.
public void lookForWorm()
if (this.canSee(Worm.class) )