Cinema Facade

Report a typo

The task is to write the correct output using the CinemaFacade.

When we come to the cinema, the first logical step is to get popcorn, so we need to turn on the PopcornPopper. After, we want the facade to turn off the Lights and turn on the Projector. Your task is to write the watchMovie() and endMovie() methods that should write the output according to our needs.

Sample Input 1:

Sample Output 1:

Get ready to watch a movie...
PopcornPopper on
PopcornPopper popping popcorn!
Lights off
Projector on
We are watching a movie
The End
PopcornPopper off
Lights on
Projector off
Write a program in Java 17
class CinemaFacadeTestDrive {
public static void main(String[] args) {
PopcornPopper popcorn = new PopcornPopper();
Lights lights = new Lights();
Projector projector = new Projector();

CinemaFacade cinemaFacade = new CinemaFacade(popcorn, lights, projector);

cinemaFacade.watchMovie();
System.out.println("We are watching a movie");
System.out.println("The End");
cinemaFacade.endMovie();
}
}

class CinemaFacade {
private PopcornPopper popcorn;
private Lights lights;
private Projector projector;

public CinemaFacade(PopcornPopper popcorn, Lights lights, Projector projector) {
this.popcorn = popcorn;
this.lights = lights;
this.projector = projector;
}

public void watchMovie() {
/* write your code here */

}

public void endMovie() {
/* write your code here */

}
}
___

Create a free account to access the full topic