/*
   Chapter 10:   The Cat Class
   Programmer:   Brad Shedd
   Date:         May 6, 2004
   Program Name: Cat.java
  Purpose:      Inherits from the animal class
*/

public class Cat extends Animal
{
  
//instance variables
   private String name;
  
protected String breed;

  
public Cat(String aName)
   {
    
super("Cat");
      name = aName;
   }

  
public Cat(String aName, String aBreed)
   {
     
super("Cat");
      name = aName;
      breed = aBreed;
  }

  
public void describe()
   {
      System.out.println(name +
", a breed of "+type+" called " + breed);
   }

 
public void sound()
   {
      System.out.println(
"Meow");
   }

  
public void sleep()
   {
      System.out.println(name+
" is having purrfect dreams!");
   }

  
public void move()
   {
      System.out.println(
"This little kitty moves fast!");
   }

  
public String getName()
   {
     
return name;
   }
}






Homepage