-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnum
More file actions
41 lines (20 loc) · 881 Bytes
/
Enum
File metadata and controls
41 lines (20 loc) · 881 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
32
33
34
35
36
37
38
39
40
41
import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
String response;
System.out.print("Enter a day of the week : ");
response=scanner.nextLine().toUpperCase();
try{
Day day=Day.valueOf(response);
switch(day){
case MONDAY,TUESDAY,WEDNESDAY,THURSDAY,FRIDAY -> System.out.println("It is a week day");
case SATURDAY ,SUNDAY-> System.out.println("It is the weekend");
}
}
catch(IllegalArgumentException e){
System.out.println("You are an asshole because you can't even type a day");
}
scanner.close();
}
}