-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathANSWER_CALL.java
More file actions
31 lines (25 loc) · 784 Bytes
/
ANSWER_CALL.java
File metadata and controls
31 lines (25 loc) · 784 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
Your cell phone rings. Return true if you should answer it.
Normally you answer, except in the morning you only answer if it is your mom calling.
In all cases, if you are asleep, you do not answer.
answerCell(false, false, false) → true
answerCell(false, false, true) → false
answerCell(true, false, false) → false
*/
package school;
public class ANSWER_CALL {
public static void main(String[] args){
boolean answer = answerCell(false, false, false);
System.out.println(answer);
}
public static boolean answerCell(boolean isMorning, boolean isMom, boolean isAsleep) {
if(isAsleep==true){
return false;
}else if(isMorning==true && isMom==true){
return true;
}
else if(isMorning == false){
return true;
}return false;
}
}