Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

readme.txt Modify theses classes to implement the Observer pattern so that Light objects can be notified when the Button object is pressed. Follow any instructions

readme.txt

Modify theses classes to implement the Observer pattern so that Light objects can be notified when the Button object is pressed. Follow any instructions present in comments.

Button.pseudo

public class Button {
public void press() {
}
}

Driver.pseudo

public class Driver {
public main(){
// create a button
// create a red light
// create a green light
// create a blue light
// have the blue light and the red light listen for the button
// press the button. Blue and red light should call turnOn in response
// NOTE: your Button class should be generic - do not hard-code these
// lights into the Button class.
}
}

Light.pseudo

public class Light{
private String color;
public Light(String color){
this.color = color;
}
// light turns on with specified color for 1 second
public void turnOn(){
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

More Books

Students also viewed these Databases questions

Question

Work through an example of attribute sampling. lop85

Answered: 1 week ago

Question

OUTCOME 2 Identify and explain the privacy rights of employees.

Answered: 1 week ago