A weather station broadcasts readings to display objects that have registered with it. Each display keeps whatever it needs from the readings it receives, and the station knows only the shared WeatherDisplay contract.
Implement these parts:
WeatherDisplay is the observer contract. It exposes update(temperature, humidity, pressure) and report().CurrentConditionsDisplay and StatisticsDisplay implement that contract.WeatherStation is the subject, and its skeleton is in the starter. registerDisplay(WeatherDisplay display) registers an object once, removeDisplay(WeatherDisplay display) removes that same object, and both return whether they changed the registration. setMeasurements(...) returns nothing and updates every registered object in order. The station must not construct displays, look them up by name, or ask them for reports.WeatherStationFacade is the driver called by the tests. It translates the string commands below into display construction, registration, removal, and reporting. Do not rewrite it; implement the types it delegates to.The provided WeatherStationFacade exposes this API:
WeatherStationFacade() creates a facade around an empty station.boolean addDisplay(String kind) registers "current" or "statistics" and returns true. An unknown name, or one that is already registered, changes nothing and returns false.boolean removeDisplay(String kind) removes that display and returns true, or returns false when it is not registered.int setMeasurements(double temperature, double humidity, double pressure) sends the reading to every registered display in registration order and returns how many displays received it.String report(String kind) returns the line that display would show right now, or "NONE" when it is not registered or has received no readings.String notifyOrder() returns the names of the displays notified by the most recent setMeasurements, joined by commas, or "NONE" when that call reached nobody.int displayCount() returns how many displays are registered.The two displays report differently:
current returns Current Conditions -> Temp: 25.0, Humidity: 65.0%, Pressure: 1013.0 hPa for the latest reading it received.statistics returns Statistics -> Avg Temperature: 26.5, averaging every temperature it has received since it registered.Every number is formatted to one decimal place. A display receives only the readings that arrive while it is registered, and removing a display discards it, so registering it again starts over with nothing.
WeatherStationFacade is the only type the tests call. Keep its string-based bookkeeping outside WeatherStation: the station should push readings through WeatherDisplay without knowing display names, concrete classes, or reporting rules.
Input:
Output:
Explanation: Both displays are registered before anything is measured, so both receive both readings. The average of 25.0 and 28.0 is 26.5, and the notification order matches the order the displays registered in.
Input:
Output:
Explanation: The statistics display registers after the first reading has gone out, so 20.0 never reaches it and its first report is NONE. After the second reading its average is the one value it received.
-100.0 <= temperature <= 100.00.0 <= humidity <= 100.0800.0 <= pressure <= 1200.01 <= kind.length <= 20, lower case letters only.100 calls in total are made across all methods.Implement the WeatherDisplay contract and its two concrete displays, then complete the WeatherStation skeleton. WeatherStationFacade is complete driver code and must not be modified.
Full marks when `WeatherStation` registers `WeatherDisplay` objects and pushes readings through that contract, while `WeatherStationFacade` alone handles names and concrete construction. Lose points heavily when `WeatherStation` constructs a concrete display, looks one up by name, computes the average itself, or branches on a display kind during notification.
Full marks when a display holds exactly the readings sent while it was registered, so a late registration excludes everything earlier and a removal followed by a fresh registration starts from nothing. Lose points when a display reads a history kept by the station, or when registering hands it the current reading.
Full marks when notification follows registration order, a duplicate or unknown name is refused without changing anything, `notifyOrder` reports `NONE` when the last call reached nobody, and every number is formatted to one decimal place. Lose points for printing to stdout.
Passing every test is not enough on its own. A submission is accepted only when the design also clears the bar.
| Call | Returns |
|---|---|
| new WeatherStationFacade() | null |
| addDisplay("current") | true |
| addDisplay("statistics") | true |
| setMeasurements(25, 65, 1013) | 2 |
| setMeasurements(28, 70, 1012) | 2 |
| report("current") | "Current Conditions -> Temp: 28.0, Humidity: 70.0%, Pressure: 1012.0 hPa" |
| report("statistics") | "Statistics -> Avg Temperature: 26.5" |
| notifyOrder() | "current,statistics" |
Both displays are registered before anything is measured, so both receive both readings. The average of 25.0 and 28.0 is 26.5, and the notification order matches the order the displays registered in.
Run checks these cases. Submit also runs a larger hidden set.

