COM1204 Summer Midterm Exam Version A
Prof. Futrelle

Monday 28 July - Closed book/notes


Be sure to write complete information in your blue exam book: Name, course, date, exam version A.

Question 1: You are to write out three class definitions and one interface definition, as Java code. You needn't specify any access priviliges (default package access) unless your use of an interface requires public access. In the description below, be sure you understand that another, text and your are the names of fields; they are the names of variable fields in their classes. The four methods discussed below are each of type void. The design in this question is an example of the Adapter Design Pattern.

Question 2: For the classes defined above, draw the corresponding (static) UML diagram for the classes and interface. Then draw the corresponding sequence diagram.

Question 3: Explain why the previous example is an example of the Adapter Design Pattern. Describe both the Object Adapter and Class Adapter patterns and explain which one is used in the example above.

HINT: A client normally expects to use service(). But the the system described here implements service() so that it ends up using some already existing functionality. Is the access to this other functionality via subclassing or by creating an object that has the functionality needed? That's the sort of question you have to ask yourself.