-
Notifications
You must be signed in to change notification settings - Fork 0
/
SwitchExercises.java
82 lines (48 loc) · 992 Bytes
/
SwitchExercises.java
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.conditionals;
public class SwitchExercises {
public static void main(String[] args) {
System.out.println(isWeekDay(8));
System.out.println(NameOfMonth(4));
}
public static boolean isWeekDay(int noOfDay)
{
switch(noOfDay) {
case 1:return true;
case 2:return true;
case 3:return true;
case 4:return true;
case 5:return true;
default:return false;
}
}
public static String NameOfMonth(int noOfMonth) {
switch (noOfMonth) {
case 1:
return "January";
case 2:
return "February";
case 3:
return "March";
case 4:
return "April";
case 5:
return "May";
case 6:
return "June";
case 7:
return "July";
case 8:
return "August";
case 9:
return "September";
case 10:
return "october";
case 11:
return" November";
case 12:
return "December";
default:
return "invalid";
}
}
}