반응형
Write a function named setAlarm which receives two parameters. The first parameter, employed, is true whenever you are employed and the second parameter, vacation is true whenever you are on vacation.
The function should return true if you are employed and not on vacation (because these are the circumstances under which you need to set an alarm). It should return false otherwise. Examples:
setAlarm(true, true) -> false
setAlarm(false, true) -> false
setAlarm(false, false) -> false
setAlarm(true, false) -> true
Solution:
bool setAlarm(bool employed, bool vacation) => true ? (employed == true && vacation == false) : false;
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
1125. MakeUpperCase (0) | 2022.11.25 |
---|---|
1124. Beginner Series #2 Clock (0) | 2022.11.24 |
1122. Grasshopper - Messi goals function (0) | 2022.11.22 |
1121. Grasshopper - Grade book (0) | 2022.11.22 |
1120. Determine offspring sex based on genes XX and XY chromosomes (0) | 2022.11.20 |