View the step-by-step solution to:

Suppose we have three classes: AlarmClock, Beeper, and AlarmWindow.

2. Suppose we have three classes: AlarmClock, Beeper, and AlarmWindow. In the following you see an interaction showing an AlarmClock sending the display message to an AlarmWindow and the beep message to Beepers when it receives the alarm message (i.e. when the clock’s alarm event occurs, it sends these messages).












Now assume you have been asked to change these classes so they collaborate according to the Observer pattern. Suppose that AlarmClocks are publishers and Beepers and AlarmWindows are observers.
a. What is the interface (name each method and give a short description of each method) that AlarmClocks must implement?
b. What is the interface (name each method and give a short description of each method) that Beepers and AlarmWindows must implement?
c. Draw a class diagram to show the relevant classes, methods, associations, and navigability for your adaptation to the Observer pattern.
d. Rewrite the above interaction to show how clock, b1, b2, and window interact according to the Observer pattern (show the messages sent when the clock’s alarm event occurs).

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question