-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lab2_1.java
69 lines (62 loc) · 1.81 KB
/
Lab2_1.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
import java.util.Scanner;
public class Lab2_1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String day= " ";
String FutureDay = " ";
System.out.print("Enter today's day: ");
int NumDay = input.nextInt();
System.out.print("Enter the number of days elapsed since today: ");
int Add = input.nextInt();
int Answer = (NumDay+Add)%7;
switch(NumDay)
{
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
break;
}
switch(Answer)
{
case 0:
FutureDay = "Sunday";
break;
case 1:
FutureDay = "Monday";
break;
case 2:
FutureDay = "Tuesday";
break;
case 3:
FutureDay = "Wednesday";
break;
case 4:
FutureDay = "Thursday";
break;
case 5:
FutureDay = "Friday";
break;
case 6:
FutureDay = "Saturday";
break;
}
System.out.println("Today is "+ day + " and the future day is "+ FutureDay );
}
}