Programming Tools
Problem for Programming Tools
Generic problem for all Programming Tools

Boolean Logic




By Mirandza on May 08, 2008

" "
A panel has 3 switches on the front which toogle options. the state of all these buttons(on or off) must bestored in a single integer variable(not an array). How this information gets to the computer is irrelevant. Using C# or Java, write briefly the function ofsetting each button state in the variable andreading off any particular button state from the variable. Create unique global constants for each button, simply write them and the functions down and not the entire program

Best Solution

posted on May 09, 2008
Helpful)

n1wgk

Rank: Master 
Rating: 94%, 75 votes
I don't know the syntax but you could easily do this with setting the switches to a constant, then adding them up. The number set would need to be something so that there would only be one solution...the one that you were looking for.

sw1 = 1
sw2 = 2
sw3 = 4

If sw1 and sw2 is both on, but sw3 is off, the number would be 3
If sw2 and sw4 was on, the number would be 6
If all were on, the number would be 7, etc.

Was this helpful?
Yes
No

Popular Solutions for Programming Tools


Questions and Unsolved Problems for Programming Tools


Answer
where can I get a customer tool disk for a sharp xa-a41s??

Answer
where can i get the authorization key and serial number for borland turbo c ++

Answer
Using photran 5.0 on eclipse (galileo) 3.5. I am having problems using large integers and reals in... (More)

Answer
How do you get around the problem of large Integers and Reals within photran eclipse? The maximum I... (More)

Answer
Got the Christmas edition r4 upgrade but can't get past the loading screen, not had this problem on... (More)


Didn't find what you were looking for?

Describe your problem:

Select a Category:







Ask our Experts

 

Solve Your Problem Now!
Chat Live with an Expert
Chat Now
Top Programming Tool Experts



Top Computer & Laptop Repairmen

(877) 934-6198
Send your laptop to us and we will diagnose the...
A+ Rated Oceanside Computer Sales & Service, LLC

(952) 890-7770
Zkarlo.com provides discount and used laptop parts...
Zkarlo.com


       
Solve Your Problem Now!
Chat Live with an Expert
Chat Now

Insert Link
Insert Image
Insert You-Tube clip
Insert List
Insert List
Spell Check

What is this?



Select