A home security system needs to be activated under specific conditions. Can you fill in the blanks in the code to make the security system work correctly? The system should be active when the door is open at night or when motion is detected.
Boolean type and operations. True and false
Night watch and motion magic
Report a typo
Fill in the gaps with the relevant elements
isSecuritySystemActive(isDoorOpen: , isNighttime: Boolean, isMotionDetected: Boolean): Boolean {
doorAndNightCondition = isDoorOpen && isNighttime
val systemActive = doorAndNightCondition || isMotionDetected
println("Security System Active: $systemActive")
return systemActive
}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.