Define an interface USB, in which contains abstract methods turnOn and turnOff. Define class Micphone, Keyboard, Mouse implement USB interface.
Define class Computer. Computer contains private USB D usb. Computer contains three public methods: void add(USB usb); void powerOn(); void powerOff). In main method , new a computer to simulate the powerOn and powerOff.
The result is as follows: