-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHotel.java
More file actions
24 lines (19 loc) · 834 Bytes
/
Hotel.java
File metadata and controls
24 lines (19 loc) · 834 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
import java.io.Console;
public class Hotel {
public static void main(String[] args) {
Console console = System.console();
System.out.println("In what season are you booking a stay?");
String season = console.readLine();
System.out.println("On the weekend, or a weeknight?");
String dayOfWeek = console.readLine();
boolean summer = season == "summer";
boolean weekend = dayOfWeek == "weekend";
if ( summer && weekend ) {
System.out.println("Your stay is probably going to be pretty expensive. It's both peak travel season AND the weekend.");
} else if ( summer || weekend ) {
System.out.println("Your stay is probably going to be pretty expensive.");
} else {
System.out.println("Your stay may be costly, but it could certainly be worse!")
}
}
}