Answered step by step
Verified Expert Solution
Link Copied!

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

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions