Question: Please provide code using Java, C#, or C++ and screenshot of output Compound Pattern The ceiling fan represents are real world model of patterns working

Please provide code using Java, C#, or C++ and screenshot of output

Compound Pattern

The ceiling fan represents are real world model of patterns working together. Please implement a ceiling fan that has the speeds of high, medium, low and off. This fan needs to come with a remote control with four buttons that can be programmed. For this exercise, program the buttons to:

Button One:

On: set fan to high

Off: Turn fan off

Button Two:

On: set fan to medium

Off: Turn fan off

Button Three:

On: set fan to low

Off: turn fan off

Button Four:

On: set fan cycle (each click will cycle to the next speed. Example: If fan is at high, the next click will move the speed to medium. The next click will move it to low. The next click will move it back to high)

Off: turn fan off

Hint:

There are two things going on here. There are commands that are being transmitted and need to be remembered (Command Pattern), and there is state (State Pattern). The remote-control button commands could be stored in a collection type, such as arrays.

You have full freedom to design and implement this solution as you see fit. The only requirements are that the user should be able to use the remote control (from the driver program) to cycle through all permutations of the fan states. You also need use at least two patterns, and you will need test and comment your code, and document your design with UML class hierarchy diagram(s).

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!