001package headfirst.combining.ducks;
002
003public class DuckSimulator {
004        public static void main(String[] args) {
005                DuckSimulator simulator = new DuckSimulator();
006                simulator.simulate();
007        }
008
009        void simulate() {
010                Quackable mallardDuck = new MallardDuck();
011                Quackable redheadDuck = new RedheadDuck();
012                Quackable duckCall = new DuckCall();
013                Quackable rubberDuck = new RubberDuck();
014
015                System.out.println("\nDuck Simulator");
016
017                simulate(mallardDuck);
018                simulate(redheadDuck);
019                simulate(duckCall);
020                simulate(rubberDuck);
021        }
022
023        void simulate(Quackable duck) {
024                duck.quack();
025        }
026}