Register  |  Login



Question

Status: Closed Points: 75 Time: 06:23 - Aug 24, 2006  

multani.sarbjit

OOPS based question of University

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.



Sample answer :

Scene pSceneA, pSceneB;
pSceneA = new Scene
pSceneB = new Scene

pSceneA.AddLight( new Light(“1”), 100 )
pSceneA.AddLight( new Light(“2”), 100 )
pSceneA.AddLight( new Light(“3”), 50 )

pSceneB.AddLight( new Light(“3”), 70 )
pSceneB.AddLight( new Light(“4”), 100 )
pSceneB.AddLight( new Light(“5”), 100 )


pSceneA.On()
pSceneB.On()
pSceneB.Off()



any solution please!!!!

Categories:

Answer Discussion
Answer Summaries

 

Q&A System for Websites and Corporate Collaboration

Advertisement

  • Generates significant organic traffic for websites
  • Saves companies money, resources, and time

admin

Date:: Aug 22, 2007

Time:: 20:17

multani.sarbjit, did you get your question solved?

If you did then please close this question and distribute the points. If you found the solution on your own, we would be very happy if you could explain it here for the sake other users having the same problem.

If you didn't get a solution to your problem, please leave a comment here to let the experts know that you're still looking for an answer.

Thanks,
The Quomon Admin Team

multani.sarbjit

Date:: Sep 14, 2007

Time:: 00:11

Admin,

Thanks for the remainder.

Question Answered

This question has been closed, and points have been rewarded to the following experts:

multani.sarbjit: 75

You're welcome however to comment or give additional information or if you wish, you have the ability to write an Answer Summary for the Summary Area.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

No summaries have been submitted yet. Want to be the first?

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

6232

2.

rcastagna

4221

3.

LAGM

3650

4.

PeterNZ

2807

5.

oracleofDelphi

2698

6.

jgivoni

1953

7.

xarcus

1820

8.

gonzalo

1000

9.

Anpanman

812

10.

theDude

695

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es