Question: class Control Panel { private LinkedList onCommands; private LinkedList offCommands; public Control Panel() { onCommands = new LinkedList (); offCommands = new LinkedList (); public

 class Control Panel { private LinkedList onCommands; private LinkedList offCommands; publicControl Panel() { onCommands = new LinkedList(); offCommands = new LinkedList(); publicvoid addOnCommand (DeviceOnCommand cmd) { onCommands.add (cmd); } public void addoffCommand (DeviceOffCommand

class Control Panel { private LinkedList onCommands; private LinkedList offCommands; public Control Panel() { onCommands = new LinkedList(); offCommands = new LinkedList(); public void addOnCommand (DeviceOnCommand cmd) { onCommands.add (cmd); } public void addoffCommand (DeviceOffCommand cmd) { offCommands.add (cmd); } public void fullonButton() { for (DeviceOnCommand cmd: onCommands) { cmd.execute(); public void fulloffButton() { for (DeviceOffCommand cmd: offCommands) { cmd.execute(); interface Device public void on(); public void off(); 1 class Light implements Device { public void on() { System.out.println("light on"); } public void off () { System.out.println("light off"); } } class IndicatorLight extends Light { public void on() { System.out.println("indicator light on"); 1 public void off () { System.out.println("indicator light off"); class SecurityCamera implements Device { public void on() { System.out.println("security camera on"); } public void off() { System.out.println("security camera off"); class DeviceOnCommand private Device device; public DeviceOnCommand (Device device) { this.device = device; } public void execute() { device.on(); } class DeviceOffCommand { private Device device; public DeviceOffCommand (Device device) { this.device = device; } public void execute() { device.off(); } class Main public static Controlpanel loadtestConfigi() { IndicatorLight indicatorLight = new IndicatorLight(); DeviceOn Command indicatorLightOnCmd = new DeviceOnCommand (indicator Light); DeviceOffCommand indicator LightoffCmd = new DeviceOffCommand (indicatorLight); SecurityCamera securityCamera = new SecurityCamera(); DeviceOnCommand cameraOnCommand = new DeviceOnCommand (securityCamera); DeviceOffCommand cameraoffCommand = new DeviceOffCommand (securityCamera); Control Panel cp = new Control Panel(); cp.addon Command (indicatorLightOnCmd); cp.addOnCommand (cameraOn Command); cp.addoffCommand (indicator LightoffCmd); cp.addoffCommand (cameraOffCommand); return cp; } public static void runControlpanelTest (Controlpanel cp, int times) { for (int i=0; i onCommands; private LinkedList offCommands; public Control Panel() { onCommands = new LinkedList(); offCommands = new LinkedList(); public void addOnCommand (DeviceOnCommand cmd) { onCommands.add (cmd); } public void addoffCommand (DeviceOffCommand cmd) { offCommands.add (cmd); } public void fullonButton() { for (DeviceOnCommand cmd: onCommands) { cmd.execute(); public void fulloffButton() { for (DeviceOffCommand cmd: offCommands) { cmd.execute(); interface Device public void on(); public void off(); 1 class Light implements Device { public void on() { System.out.println("light on"); } public void off () { System.out.println("light off"); } } class IndicatorLight extends Light { public void on() { System.out.println("indicator light on"); 1 public void off () { System.out.println("indicator light off"); class SecurityCamera implements Device { public void on() { System.out.println("security camera on"); } public void off() { System.out.println("security camera off"); class DeviceOnCommand private Device device; public DeviceOnCommand (Device device) { this.device = device; } public void execute() { device.on(); } class DeviceOffCommand { private Device device; public DeviceOffCommand (Device device) { this.device = device; } public void execute() { device.off(); } class Main public static Controlpanel loadtestConfigi() { IndicatorLight indicatorLight = new IndicatorLight(); DeviceOn Command indicatorLightOnCmd = new DeviceOnCommand (indicator Light); DeviceOffCommand indicator LightoffCmd = new DeviceOffCommand (indicatorLight); SecurityCamera securityCamera = new SecurityCamera(); DeviceOnCommand cameraOnCommand = new DeviceOnCommand (securityCamera); DeviceOffCommand cameraoffCommand = new DeviceOffCommand (securityCamera); Control Panel cp = new Control Panel(); cp.addon Command (indicatorLightOnCmd); cp.addOnCommand (cameraOn Command); cp.addoffCommand (indicator LightoffCmd); cp.addoffCommand (cameraOffCommand); return cp; } public static void runControlpanelTest (Controlpanel cp, int times) { for (int i=0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!