/**
 * A guard dog that may or may not be fierce.
 * 
 * @author Drue Coles
 */
public class GuardDog extends Dog {

    private final boolean isFierce;
    
    /**
     * Creates a guard dog with a given name, license number, and fierceness status.
     */
    public GuardDog(String name, int licence, boolean isFierce) {
        super(name, licence);
        this.isFierce = isFierce;
        System.out.println("TESTING: in 3-argument GuardDog constructor.");
    }
    
    /**
     * Creates a fierce guard dog with a given name and license number.
     */
    public GuardDog(String name, int licence) {
        this(name, licence, true);
        System.out.println("TESTING: in 2-argument GuardDog constructor.");
    }
    
     /**
     * Returns a greeting from this guard dog.
     */
    @Override
    public String toString() {
        return super.toString() + " I am " + (isFierce ? "fierce." : "meek.");
    }
    
    /**
     * This dog attacks or retreats depending on whether it is fierce.
     */
    public void attackStranger() {
        if (isFierce) {
            System.out.println(name + " is attacking a stranger.");
        } else {
            System.out.println(name + " is running away from a stranger.");
        }
    }   
    
    public static void main(String[] args) {
        GuardDog dog = new GuardDog("Atlas", 17815);
        System.out.println(dog);
        dog.speak();
        dog.attackStranger();
    }
}