package class2_1_DuckStrategies_v7_Factory.ducks; import class2_1_DuckStrategies_v7_Factory.StandardQuacking; import class2_1_DuckStrategies_v7_Factory.StandardSwimming; import java.awt.Point; /** * This class represents a specialized type of Duck * @author hornick */ public class Redhead extends Duck { /** * Redhead-specific constructor */ public Redhead(String name) { super(name, "redhead.jpg"); this.setBehaviors(new StandardSwimming(this), new StandardQuacking(this)); // this value defines how far a Redhead moves each update period - s random value between 1 and 3. increment = new Point(random.nextInt(1)+3, random.nextInt(1)+3); //Note that the duck's image and incremental movements could potentially be parameterized // as constructor call arguments, but this would increase the coupling between this class and the // class invoking the constructor, since the invoking class would then have to know more about // the inherent behavior of each type of duck created. } }