Quizzes 10-14.pdf - CMPUT 301 Fa17 INTRO TO SOFTWARE...

Info icon This preview shows pages 1–4. Sign up to view the full content.

CMPUT 301 Fa17 - INTRO TO SOFTWARE ENGINEERING Combined LAB LEC Fa17 Quiz 10 Apply the composite design pattern to: model the structural representation of binary logical expressions involving the binary operators and and or, and boolean literals true and false; and support the uniform, recursive evaluation of such expressions Draw the UML class diagram for the object-oriented design, applying the design pattern. Include suitable classes, relationships, attributes, and methods. Submit your class diagram as a PNG file.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

CMPUT 301 Fa17 - INTRO TO SOFTWARE ENGINEERING Combined LAB LEC Fa17 Quiz 11 You have a design where a two-dimensional rectangle drawing method takes a top left point and a bottom right point. Also, in your design, the points are specified by integer x and y coordinates. public interface RectangleDrawer { public void draw( Point topLeft, Point bottomRight ); } Suppose, however, you want to reuse a rectangle drawing method that takes four integer parameters: top left x coordinate, top left y coordinate, width, and height. public class RectangleRender { public void render( int x, int y, int width, int height ) { ... } ... } Write Java code for a rectangle drawing object adapter. public class RectangleDrawerAdapter ... Submit your code as a .java file.
Image of page 2
CMPUT 301 Fa17 - INTRO TO SOFTWARE ENGINEERING Combined LAB LEC Fa17 Quiz 12 Apply the decorator design pattern to build up the structure of a pizza and to calculate its total cost. Starting with a base (e.g., thick crust), you can decorate with successive toppings (e.g., rich sauce, then pepperoni, then cheese). Each base or topping has a specific incremental cost to add to the total cost. Draw a UML sequence diagram for the behavior of the object-oriented design with the above base and toppings, applying the design pattern.
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern