/**
 * 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 PrivateRooster extends PrivateChicken {
    
    // ------------ 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 PrivateRooster(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 PrivateRooster 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
        this.setWeight(this.getWeight() + WEIGHT_GAIN);
        this.setHeight(this.getHeight() + HEIGHT_GAIN);
    }
    
    public static void main(String argv[]) {
        PrivateRooster leghorn = new PrivateRooster("Foghorn", 22, 10);
        System.out.println(leghorn);
        leghorn.crow();
        leghorn.feed();
        System.out.println(leghorn);
    
        PrivateRooster fedLeghorn = new PrivateRooster("Foghorn", 24, 10.5);
    
        if( ! leghorn.equals(fedLeghorn) ) {
            System.out.println("Error in feeding rooster");
        }
        
        /** TODO: MORE TESTING! **/
    }

}
