int hairLength;
and the following methods:
public void cutHair(int amountToCut) - subtracts amountToCut from hairLength (if you end up with a negative value
then set hairLength to zero)
public void wink (int howMany) - if hairLength is greater than 10 then wink won't do anything since the eye
will be covered by the hair, otherwise do the same as the inherited version.
Face f = new Bunny(this); HappyFace hf = (HappyFace)f; hf.wink(10);
Face f = new HappyFace(this); f.wink(10);
HairyHappyFace hhf = new HairyHappyFace(this); hhf.cutHair(5); hhf.wink(10); hhf.setEyeColor(Color.green);
Bunny b = new Face(this); b.hop(5, 10);
Bunny b; b.hop(5, 10); b.setSurprise(true); b.setEarColor(Color.yellow);
Face f = new HairyHappyFace(this); f.setVisible(true); f.move(100, 100);
|
|