Preparing your design workspace

Loading the problem and your saved attempt…

Design an Earbud Connection and Playback Model

Model an earbud’s connection, playback and volume, then extend it with an optional model capability.

Design an earbud object model with attributes, behavior and clear OOP responsibilities.

For this exercise, assume one simulated earbud starts disconnected and not playing, with integer volume 5. A user connects one device, starts or pauses playback, disconnects, changes volume and reads status. Valid volume is 0 through 10 and may change while disconnected. Playback requires a connection.

Disconnect stops playback and removes the device association while retaining volume. Repeated play while connected, pause and disconnect are harmless. Connecting the same device again succeeds unchanged; connecting a different device while already connected is rejected.

Caller-supplied device IDs are valid nonempty immutable values. Invalid volume and disconnected play are rejected without any state change.

Design the objects, operation contracts and interactions, and explain how OOP concepts help the model. No implementation code is required. For this exercise, assume one caller and an in-memory simulation; actual Bluetooth, audio decoding,hardware,persistence,UI and pairing security are outside scope.

For the follow-up, assume some models support Boolean noise cancellation, initially off and retained across connection changes, while others do not. An unsupported command is rejected without mutation. Explain a truthful capability boundary, how shared callers use it and how you would test the extension.