Question: Automatic doors are controlled by three sensors. One sensor detects whether someone is standing on the doors front pad, the second sensor detects whether someone
Automatic doors are controlled by three sensors. One sensor detects whether someone is standing on the doors front pad, the second sensor detects whether someone is standing on the doors rear pad, and the third sensor detects whether the door is open or closed. - 2 - The motor controlling the door is activated - to open the door and / or hold the door open - based on the data produced by these sensors. You can use 1 to represent that a pad is occupied and 0 to represent that it is not. Similarly, you can use 1 to represent that the door is open and 0 to represent that it is closed. Using the state (0 or 1) of the pads and the door, you can then determine whether the door should be activated. The doors motor should not be activated when both pads are empty. It should be activated, however, if the front pad is occupied, the rear pad is unoccupied, and the door is closed, or if the front pad is unoccupied, the rear pad is occupied, and the door is open. The following table describes under what conditions the door should (or should not) be activated:
Front pad Rear pad Door Activate door
0 0 0 no
0 0 1 No
0 1 0 No
0 1 1 Yes
Step 1: Create a program that determines whether or not to activate an automatic door: Input: State of front pad (0 = empty, 1 = occupied) State of rear pad (0 = empty, 1 = occupied) State of door (0 = closed, 1 = open) Output: A message stating whether or not the door should be activated Step 2: Save your program as sesame.cpp Step 3: Test your program using the following test plan. If you discover mistakes in your program, correct them and execute the test plan again.
Test Plan for sesame
Test Case Sample data Expected result Checked
Front pad empty Rear pad empty Door closed 0 0 0 Do not activate the door
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
