Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:

We are writing the software for a new electronic hand dryer. The dryer has a light sensor which can determine whenever someone's hands are placed under it. This triggers the dryer to start blowing hot air. The dryer can also be triggered via a push button on the unit. Once the unit starts blowing, we do not want additional pushes of the button or triggers of the light sensor to extend the air blowing cycle.

Select the most appropriate design pattern to use to address the problem and show how it is applied. In particular, show an appropriate class diagram(s) and enough code fragments to illustrate your use of the pattern to solve the problem.
Posted
Comments
Sergey Alexandrovich Kryukov 21-Mar-14 16:59pm    
Not a question. This is just the work to be done, it does not require any expert's advice. If you did the job and faced some problems, explained then, it would be a different story.
—SA

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!
 
Share this answer
 
Comments
Junior Frogie 21-Mar-14 13:33pm    
:(
For future use and answers, use this pattern:
http://en.wikipedia.org/wiki/Command_pattern

Design patterns are hard at start. The key is to pick the parts in the question. It says switch on or off. Even if I do or don't know the pattern, I would take the switch part and go through all the design patterns 10-20 the lecturer has given you. The examples the lecturer will have certain words that trigger what pattern should be used. It won't be a trick question or something you have to research very hard. It's all in the IT notes you were given.

In this case, the command pattern has a switch, your hairdryer has an event and triggers something. It then has a state (possible other design pattern).

The rest even if you are right or "slightly" wrong, the lecturer will give you marks for the attempt. If you said singleton, builder or something that does not make sense (which he will have a list of design patterns) he will mark you down.

If you are repeating this year the same course, at least you'll know how to get the answer!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900