Question: Where Can I add in some defensive Programming A lamp outside a front door comes on automatically when it is dark, and someone stands on

Where Can I add in some defensive Programming

Where Can I add in some defensive Programming A lamp outside a

  • A lamp outside a front door comes on automatically when it is dark, and someone stands on the doormat outside the front door.
  • A pressure sensor under the mat changes from OFF (0) to ON (1) when someone stands on the doormat.
  • The light sensor is ON (1) when it is light and OFF (0) when it is dark.
  • Design a program to show what would happen to the lamp. Account for all possible scenarios by determining whether the pressure sensor and light sensor are ON or OFF. (HINT: Ask the user Is it dark? and Is someone standing on the doormat outside the front door?)
  • A lamp outside a front door comes on automatically when it is dark, and someone stands on the doormat outside the front door.
  • A pressure sensor under the mat changes from OFF (0) to ON (1) when someone stands on the doormat.
  • The light sensor is ON (1) when it is light and OFF (0) when it is dark.
  • Design a program to show what would happen to the lamp. Account for all possible scenarios by determining whether the pressure sensor and light sensor are ON or OFF. (HINT: Ask the user Is it dark? and Is someone standing on the doormat outside the front door?)

- File Edit Scale View Run Mode Ink Window Generate Help 22 80% Symbols main Assignment Start Call Input Output "Is it dark? Press 1 for Yes Press 0 for No" GET LightSensor "Is someone standing on the door mat? 1 for yes o for no" GET Pressursenso LightSensor=l and Pressure Sensor=1 Selection Loop & 1 = on on $ PUT "Lamp is ONT LightSensor=l and PressureSensor=0 "lightsensor: 5 pressuresensor: 6 userinput 1 PUT "Lamp is off's LightSensor=0 and PressureSensor=) & 0 on/off & off of PUT "Lamp is off LightSensor=0 and Pressure Sensor=1 O & 1 on/off PUT "Lamp is OFF" PUT "Lamp is ONT End

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!