Question: 1 . A computer is connected to three switches that can be on or off and one bulb that can be on or off. It

1. A computer is connected to three switches that can be on or off and one bulb that can be on or off.
It can read the state of each of the switches into variables, e.g:
var1= switch1
It can turn the bulb on or off using a line of code, e.g.
Bulb = TRUE
Bulb = var1
Write short algorithms to meet the following scenarios;
a. Turn the bulb on when all three switches are on
b. Turn the bulb on when switch 1 is on and the other switches are off
c. Turn the bulb off when switch 2 is on and the other switches are off
d. Turn the bulb on when switch 3 is on and either switch 1 or 2 is on, but not both
e. Turn the bulb on when only one switch is on
f. Turn the bulb on when any two switches are on, and the remaining switch is off

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!