Company: Paypay_SDE
Difficulty: medium
Weather Monitoring System using Observer Design Pattern Problem Description Build a weather monitoring system in the Observer style. A single WeatherStation holds four measurements - temperature , humidity , pressure and windSpeed - and any number of named display elements may subscribe to it. Each display subscribes to exactly one of the four measurements, and whenever that measurement is written the station notifies it. The station is driven by a script of commands, one per line, and your job is to produce the text the system would print. Implement processCommands , which receives the command lines in order and returns the output lines in order. Commands REGISTER <name> <type> - subscribe a display called <name> to <type> . If a display with that name is already subscribed, nothing happens and nothing is printed. Otherwise it is appended to the station's observer list and <name> registered. is printed. REMOVE <name> - unsubscribe the display called