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?
Boolean type and operations. True and false
Night guard's digital watchdog dilemma
Report a typo
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);Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.