/**
 * Class represents a rooster, which is a specialized Chicken.
 * 
 * Example of how to extend a class whose instance variables are *private*.
 * 
 * @author Sara Sprenkle
 */
public class Rooster extends Chicken {

    /** the amount of weight the rooster gains during feeding */
    private static double WEIGHT_GAIN = .5;

    /** the amount of height the rooster gains during feeding */
    private static int HEIGHT_GAIN = 2;
    
    /**
     * Construct the Rooster with the given characteristics.
     *
     * @param name the name of the chicken
     * @param height the height of the chicken in centimeters
     * @param weight the weight of the chicken in pounds
     */
    public Rooster(String name, int height, double weight) {
        // call to the super constructor must be the first line in constructor
        super(name, height, weight, false);
        // NOTE: reduces amount of code required in Rooster class,
        // increases code reuse, decreases code duplication
    }
    
    // new functionality
    /**
     * Displays the Rooster's signature phrase
     */
    public void crow() {
        System.out.println("Cocka-Doodle-Doo!");
    }
    
    /**
     * overrides superclass; greater gains by rooster
     */
    @Override
    public void feed() {
        this.setWeight(this.getWeight() + WEIGHT_GAIN);
        this.setHeight(this.getHeight() + HEIGHT_GAIN);
    }
    
    public static void main(String argv[]) {
        Rooster leghorn = new Rooster("Foghorn", 22, 10);
        System.out.println(leghorn);
        leghorn.crow();
        leghorn.feed();
        System.out.println(leghorn);
    
        Rooster fedLeghorn = new Rooster("Foghorn", 24, 10.5);
    
        if( ! leghorn.equals(fedLeghorn) ) {
            System.out.println("Error in feeding rooster");
        }
    
        
        /** TODO: MORE TESTING! **/
    }

}
