Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . A computer is connected to three switches that can be on or off and one bulb that can be on or off. It
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, eg:
var switch
It can turn the bulb on or off using a line of code, eg
Bulb TRUE
Bulb var
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 is on and the other switches are off
c Turn the bulb off when switch is on and the other switches are off
d Turn the bulb on when switch is on and either switch or 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started