Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!