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
- What was the justification given for the Massacre of the Pequot Natives by the British? How did this massacre change the way the war was conducted with Native
- What advice might the ATO provide in regards to legislation related to taxes reported on activity statements? 150-180 words
- In today's world, both government and the private sector are struggling to provide a secure, efficient, timely, and separate means of delivering essential