/** An executive: an employee with a bonus. */
public class Executive extends Employee {
    /** Yearly bonus */
    private double bonus;
    
    /* PRINCIPLE: ALWAYS INITIALIZE THE SUPERCLASS
     * FIELDS FIRST. 
     * 
     * If a constructor does not start with a
     * call on another constructor, Java inserts the
     * call
     *      super();
     */
    
    /** 
     * Constructor: a person with name n, year hired d,
     * salary 50,000, and bonus b 
     */
    public Executive(String n, int d, double b) { 
        super(n,d);
        bonus = b;
    }

    /** Yields: this executiveÕs bonus */
    public double getBonus() {
        return bonus; 
    }
    
    /** Yields: this executiveÕs yearly compensation */
    public double getCompensation() {
        return super.getCompensation() + bonus; 
    }
    
    /** Yields: a representation of this executive */
    public String toString() { 
        return super.toString() + ", bonus " + bonus; 
    }
}