The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
MatLab:
You are analyzing a machine that uses three different switches (SW1, SW2, SW3). They are connected to a light bulb and only certain combinations of these switches will turn the light bulb on. There combinations are given in the table below. (1=on 0=off)
| SW1 | SW2 | SW3 | SW4 |
|
0 |
0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
Write a script file that will ask the user for the state of each switch. (1 for on and 0 for off) and then return the corresponding state of the light bulb. Create a separate function where you use logical operators to figure out the state of the light bulb and return the output and display the state with fprintf.
(Hint: DO NOT over complicate this task. No A????1ifA????1 statements allowed just binary inputs and binary outputs)
Once you get the program working, enter the following values.
b. SW1=1 SW2=1 SW3=0
c. SW1=0 SW2=1 SW3=1
d. SW1=1 SW2=0 SW3=0
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll