Night guard's digital watchdog dilemma

Report a typo

A home security system needs to be programmed. The alarm should activate at night if motion is detected or the door is open. Can you fill in the blanks in the code to make the alarm work correctly?

Fill in the gaps with the relevant elements
 isNight = ;
boolean motionDetected = ;
boolean doorOpen = true;
boolean activateAlarm = isNight && (motionDetected || doorOpen);
System.out.println("Alarm activated: " + activateAlarm);
FalsetrueTruebooleanfalseBoolean

Create a free account to access the full topic