-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsleepIn.java
More file actions
35 lines (31 loc) · 1.07 KB
/
Copy pathsleepIn.java
File metadata and controls
35 lines (31 loc) · 1.07 KB
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
32
33
34
35
/*
The parameter weekday is true if it is a weekday, and the parameter vacation
is true if we are on vacation. We sleep in if it is not a weekday or we're on
vacation. Return true if we sleep in.
*/
package codingbat;
public class SleepIn {
static boolean sleepFlag = false;
public static void main(String[] args) {
SleepIn brad = new SleepIn();
SleepIn angie = new SleepIn();
System.out.println("BRAD: ");
brad.sleep(false, true);
System.out.println("\nANGIE: ");
angie.sleep(false, false);
}
public static void sleep(boolean weekday, boolean vacation){
if (!weekday && vacation){
System.out.println("We will sleep in!");
}
else if(weekday && vacation){
System.out.println("We will not sleep in!");
}
else if(!weekday && !vacation){
System.out.println("We will not sleep in!");
}
else if(weekday&& !vacation){
System.out.println("We will not sleep in!");
}
}
}