G
Guest
I am trying to solve the following take home assignment problem. I am not
sure whether to use Hashtables, events and shared members or could it be done
more easily? Also, do I need to implement a Generic Collection for Light
class? Any help in terms of pseudo code or implementation would be
appreciated.
----------------
Define a set of classes and methods to model these entities:
- a Light that you can turn on and off
- a Light that you can turn on and off and also set to a specific light
level e.g. 50% brightness.
- a Scene which contains a number of Lights, with a level specified for each
Light
o a Scene can be turned on or off
o Lights can be in multiple Scenes
o A Light is only turned off if all Scenes that it is part of are off
In our scenario we have 2 Scenes (A and B).
Scene A
- Lights 1 (on), 2 (on), and 3 (50%).
Scene B
- Lights 3 (70%), 4 (on), and 5 (on)
Write some client code that will create the objects to model our 2 Scenes,
turn on both scenes, then turn off Scene B. Please show the implementation
that will allow Light 3 to stay on after Scene B is turned off.
sure whether to use Hashtables, events and shared members or could it be done
more easily? Also, do I need to implement a Generic Collection for Light
class? Any help in terms of pseudo code or implementation would be
appreciated.
----------------
Define a set of classes and methods to model these entities:
- a Light that you can turn on and off
- a Light that you can turn on and off and also set to a specific light
level e.g. 50% brightness.
- a Scene which contains a number of Lights, with a level specified for each
Light
o a Scene can be turned on or off
o Lights can be in multiple Scenes
o A Light is only turned off if all Scenes that it is part of are off
In our scenario we have 2 Scenes (A and B).
Scene A
- Lights 1 (on), 2 (on), and 3 (50%).
Scene B
- Lights 3 (70%), 4 (on), and 5 (on)
Write some client code that will create the objects to model our 2 Scenes,
turn on both scenes, then turn off Scene B. Please show the implementation
that will allow Light 3 to stay on after Scene B is turned off.