A remote control works with a device it is pointed at. Remotes come in kinds, devices come in kinds, and any remote should drive any device. Without a bridge that is one class per combination; with one, the remote holds a device reference and each side grows on its own.
RemoteLab is provided in the starter code. Implement only the bridge: the Device implementor contract with TV and Radio, and the Remote abstraction with AdvancedRemote (IDevice in C#, a RemoteControl interface with Remote and AdvancedRemote structs in Go).
Device exposes name(), step(), isOn(), enable(), disable(), getVolume() and setVolume(volume), which clamps to 0..100.TV is named TV, steps by 10, and starts off at volume 30. Radio is named Radio, steps by 5, and starts off at volume 20.Remote(device) exposes setDevice(device), togglePower(), which returns "TV: ON" or "TV: OFF", volumeUp() and volumeDown(), which move the volume by the device's step and return "TV vol 40", and status(), which returns "TV: ON vol 40".AdvancedRemote extends Remote with mute(), which sets the volume to 0 and returns "TV muted".The provided RemoteLab exposes this API:
RemoteLab() starts with a basic remote on a fresh TV.boolean setDevice(String kind) creates a fresh "tv" or "radio" and points the current remote at it. Any other kind returns false.boolean setRemote(String kind) replaces the remote with a "basic" or "advanced" one wrapping the current device. Any other kind returns false.String togglePower(), String volumeUp(), String volumeDown() and String status() delegate to the remote.String mute() delegates to an advanced remote, or returns "UNSUPPORTED" for a basic one.String pairing() returns "<remote kind> on <device kind>".The tests call the provided RemoteLab; your work should be confined to the two hierarchies and the reference between them.
Input:
Output:
Explanation: The basic remote drives the TV through the device contract. Mute is not part of the basic remote, so the harness reports it as unsupported.
Input:
Output:
Explanation: Swapping the remote and then the device gives an advanced remote on a radio. The radio's step is five and the advanced remote can mute it.
kind is a lower case word of at most 10 characters.100 calls in total are made across all methods.Implement Device, TV, Radio, Remote and AdvancedRemote. RemoteLab is complete and must not be modified.
Full marks when `Remote` holds a `Device` and every operation goes through that contract, so `TV` and `Radio` differ only in name, step and starting volume while `Remote` and `AdvancedRemote` differ only in the operations they offer. Lose points heavily when the remote checks which device it holds or a device knows about remotes.
Full marks when `setDevice` re-points the existing remote and `setRemote` wraps the existing device, so a device swap keeps the remote kind and a remote swap keeps the device state. Lose points when a swap resets the other side.
Full marks when volume clamping and the per-device step live in the concrete devices and the remote only adds or subtracts the step. 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 RemoteLab() | null |
| togglePower() | "TV: ON" |
| volumeUp() | "TV vol 40" |
| volumeUp() | "TV vol 50" |
| status() | "TV: ON vol 50" |
| mute() | "UNSUPPORTED" |
The basic remote drives the TV through the device contract. Mute is not part of the basic remote, so the harness reports it as unsupported.
Run checks these cases. Submit also runs a larger hidden set.

