Answer:
(vaultClosed OR (heardNoise AND sawMovement))
Explanation:
The first step is to understand the conditions that must be satisfied to alarm notifies the police.
"The automatic alarm should notify the police IF there is noise and movement in the bank, or <u>IF</u> the bank vault is open".
The first IF (bold), sets the first condition which is formed by two sub-conditions: "noise AND movement". The word AND is very important because both sub-conditions must be satisfied, if there is noise but no movement, the the whole condition is not satisfied and the alarm does not notify, and vice versa.
The second IF (underlined), sets the second condition and is about the bank vault is open.
In conclusion, there are two ways to alarm notify the police.
- There is noise and movement (must be both)
- The bank vault is open
As can be either, the operator OR is used.
(condition 1) OR (condition 2)
Now, condition 1 is formed by two.
<u>FINAL EXPRESSION</u>
(condition 1) OR (condition 2)
((heardNoise equals True AND sawMovement equals True) OR vaultClosed equals True)
<u>REAL CODE</u>
Depending on the programming language you are using, the way to write the expression could vary. If C language is used, the expression would be:
if((heardNoise==1 && sawMovement==1) || vaultClosed==1))
The number 1 refers to the word TRUE