A home theater has a projector, a sound system, and a streaming player. Starting or ending a movie requires all three devices, but callers should not need to know the individual setup steps.
Implement only the HomeTheaterFacade class:
String[] watchMovie(String title) turns on the projector, sets the volume to 7, and starts the player. It returns a header, the three device responses, and a footer in that order.String[] endMovie() stops the player, sets the volume to 0, and turns off the projector. It returns a header, the three device responses, and a footer in that order.String adjustVolume(int level) asks the sound system to set the requested level and returns its response.boolean projectorOn(), String playerStatus(), and int volumeLevel() return the current state reported by the corresponding device.int sessionCount() returns the number of times watchMovie has run.The sound system accepts levels from 0 to 10. It settles an out-of-range request at the nearest limit. The facade should not repeat this rule; it should delegate the request and query the stored result.
The supporting Projector, SoundSystem, and StreamingPlayer classes, along with the public FacadeDriver test harness, are complete in the starter code. Implement only HomeTheaterFacade; do not modify the supplied types. The examples use FacadeDriver operations because that is the class the tests instantiate.
Input:
Output:
Input:
Output:
1 <= title.length <= 30-20 <= level <= 30100 calls are made across all methods.Only HomeTheaterFacade is unfinished. The supporting device classes and FacadeDriver test harness are pre-implemented; do not modify them.
Full marks when watchMovie turns on the projector, sets volume to 7, and starts the player in that order, while endMovie stops the player, mutes the sound, and turns off the projector in that order. Lose points when a device is skipped or the facade invents a device response.
Full marks when projectorOn, playerStatus, and volumeLevel query the supplied subsystem objects, and adjustVolume delegates clamping to SoundSystem. Lose points when the facade stores copies of device state or clamps the level itself.
Full marks when sessionCount increases once per watchMovie call, never changes for direct volume adjustments or endMovie, and methods return values instead of printing. Lose points for counting device calls or duplicating subsystem behavior.
Passing every test is not enough on its own. A submission is accepted only when the design also clears the bar.
| Call | Returns |
|---|---|
| new FacadeDriver() | null |
| watchMovie("Arrival") | ["--- Starting movie: Arrival ---","Projector: Turned on.","Sound: Volume set to 7.","Player: Playing Arrival.","--- Enjoy the movie! ---"] |
| projectorOn() | true |
| playerStatus() | "playing:Arrival" |
| volumeLevel() | 7 |
| sessionCount() | 1 |
The facade runs the three setup steps in order. The queries then read the state held by each device.
Run checks these cases. Submit also runs a larger hidden set.

