// --------------------------------------------------------
// Dog.java
//
// File Revision Date: 11/16/01
// --------------------------------------------------------

public class Dog extends Pet
{
  public static final int MAX_SCRATCHES = 2;
  
  private String name;
  private int numScratches;
    
  public Dog ()
  {
  }

  public void bark ()
  {
  	System.out.println ("Arf!");
  }  

  public void growl ()
  {
    System.out.println ("Grrrr!");
  }

  public void yelp ()
  {
    System.out.println ("Awooo!");
  }

  public void bite (Cat cat)
  {
    System.out.println ("Chomp!!!");
    cat.bitBy (this);
  }

  public void scratchedBy (Cat cat)
  {
    numScratches++;

    if (numScratches > MAX_SCRATCHES)
      runAway ();
    else
    {
      yelp ();
      growl ();
      bite (cat);
    }
  }

  public void runAway ()
  {
    System.out.println ("Yike! Yike! Yike!...");
  }
}
