-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdatum.java
62 lines (49 loc) · 1004 Bytes
/
datum.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
import java.util.Scanner;
public class datum {
public static void cycle(int a)
{
if(a == 6)
a=0;
else
a++;
}
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
int day = scan.nextInt();
int month = scan.nextInt();
String[] days = {"Monday", "Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"};
int index = 0;
if(month == 1)
index = 3;
else if(month == 2)
index = 6;
else if(month == 3)
index = 6;
else if(month == 4)
index = 2;
else if(month == 5)
index = 4;
else if(month == 6)
index = 0;
else if(month == 7)
index = 2;
else if(month == 8)
index = 5;
else if(month == 9)
index = 1;
else if(month == 10)
index = 3;
else if(month == 11)
index = 6;
else if(month == 12)
index = 1;
day--;
while(day --> 0)
{
index++;
}
System.out.println(days[index%7]);
scan.close();
}
}