/**
 * Class represents a rooster, which is a specialized Chicken
 * 
 * Example of how to extend a class whose instance variables are *protected*.
 *
 * @author Sara Sprenkle
 */
public class ProtectedRooster extends ProtectedChicken {
    
    // ------------ CLASS VARIABLES ---------------------

    /** 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 ProtectedRooster( String name, int height, double weight ) {
        // call to the super constructor must be the first statement in constructor
        super( name, height, weight, false);
        // NOTE: call to super's constructor 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!");
    }
    
    /**
     * Feed the rooster.  The rooster gains weight and its height increases.
     */
    @Override
    public void feed() {
        //overrides superclass; greater gains by rooster
        weight += WEIGHT_GAIN;
        height += HEIGHT_GAIN;
    }
    
    public static void main(String argv[]) {
        ProtectedRooster leghorn = new ProtectedRooster("Foghorn", 22, 10);
        System.out.println(leghorn);
        leghorn.crow();
        leghorn.feed();
        System.out.println(leghorn);

        ProtectedRooster fedLeghorn = new ProtectedRooster("Foghorn", 24, 10.5);
    
        if( ! leghorn.equals(fedLeghorn) ) {
            System.out.println("Error in feeding rooster");
        }
    
    
        /** TODO: MORE TESTING **/
    }

}
