Strategy Pattern

More information on the design patterns below can be found at:

  1. Strategy is a design pattern that objectifies (i.e., makes into an object) a selected method, so that the method can be given multiple implementations. The UML class diagram of Strategy is shown below starting from its initial configuration through adding of multiple implementations:

Using the refactorings given in class (or variants, as you need), derive the above design pattern. Be precise in explaining variants (i.e., don't be sloppy); grades will reflect clarity of your answer.

  1. Here is a poorly designed Java program.  Beautify it using Strategy and an enum for Bob's moods (and anything else you might desire):

public class Bob {

public static void main(String[] args) {
Bob b = new Bob();

String mood(int mymood) {
switch (mymood) {
case 1:
return "Grumpy";
case 2:
return "OK";
case 3:
return "Happy";
throw new RuntimeException("unknown mood");

Your assignment is to submit a single PDF file that
Submit your answers in a PDF file ONLY.  All other file formats will be rejected and a zero (0) given as a grade.