ACS-3913 Assignment 1 due Wednesday Jan 25, 2017 1. Consider the text's example for the Strategy pattern. Design and code three new classes: a new kind of duck (myDuck), a new flying strategy, and a new quacking strategy. Your duck should be initialized/constructed to use your new strategies. Test your implementation: Duck m = new MyDuck(); m. performFly(); m.setFlyBehavior(new FlyWithWings()); m. performFly(); m. performQuack(); m.setQuackBehavior(new Squeak()); m. performQuack (); For this assignment drawings may be done by hand, but they must be neat and readable. a) Draw an object diagram to show all the objects and links at the time the last statement is executing. b) Draw a sequence diagram to show the messages sent for the last 3 statements above. Submit your diagrams and three .java files (MyDuck and 2 new strategies). 2. Consider the dofactory.com “real-world” example for the Observer design pattern. Develop this example in Java and include two interfaces (Subject and Observer). You will have a driver class with a main method similar to the one in their example. So, the set of Java classes should be: Driver, Observer, Subject, Investor, and Stock. Submit your .java files. Submit your assignment via email to [email protected] Drawings may be submitted on paper or scanned to a .pdf
© Copyright 2026 Paperzz