Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a sequence diagram with the call to runControlPanelTest( ) as the founding message. Include only the relevant objects in the diagram. Use an interaction

image text in transcribedimage text in transcribed

Create a sequence diagram with the call to runControlPanelTest( ) as the founding message. Include only the relevant objects in the diagram. Use an interaction frame to describe the test loop in Main. For the loops in ControlPanel, show the actual messages they will send, in other words imagine they are not loops but a series of calls to specific objects.

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 addoff Command (DeviceOfCommand cmd) { of Commands.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(); class Light implements Device { public void on() { System.out.println("light on"); public void off() { System.out.println("light off"); } class Indicator Light extends Light public void on() { System.out.println("indicator light on"); } 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 DeviceOfCommand (Device device) { this.device = device; } public void execute() { device.off(); } class Main public static Control Panel loadTestConfigi () { Indicator Light indicator Light = new IndicatorLight(); DeviceOnCommand indicatorLightOnCmd = new DeviceOnCommand (indicatorLight); DeviceoffCommand indicatorLightoffCmd = new DeviceOfCommand (indicator Light); SecurityCamera securityCamera = new SecurityCamera(); DeviceonCommand cameran Command = new DeviceOnCommand (securityCamera); DeviceOffCommand cameraoffCommand = new DeviceOffCommand (securityCamera); Control Panel cp = new Control Panel(); cp.addonCommand (indicator LightOnCmd); cp.addonCommand (cameraOnCommand); cp.addoffCommand (indicatorLightoffCmd); cp.addoffCommand (cameraoffCommand); return cp; 1 public static void runControl PanelTest (Control Panel cp, int times) { for (int i=0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions