View difference between Paste ID: 6RmZ4gyx and WwDpX8Tv
SHOW: | | - or go back to the newest paste.
1
// 01.05.2021
2
import java.util.Scanner;
3
4
public class Ex05 {
5
6
	public static void main(String[] args) {
7
		Scanner in = new Scanner(System.in);
8
9
		int d;
10
		String day;
11
12
		// input data from user
13
		System.out.print("Enter day number ");
14
		d = in.nextInt();
15
16
		/*
17
		 * if (d == 1) { day = "Synday"; } else if (d == 2) { day = "Monday"; } else if
18
		 * (d == 3) { day = "Tuesday"; } . . .
19
		 */
20
		switch (d) {
21
		case 1:
22
			day = "sunday";
23
			break;
24
		case 2:
25
			day = "monday";
26
			break;
27
		case 3:
28
			day = "Tuesday";
29
			break;
30
		case 4:
31
			day = "Wednesday";
32
			break;
33
		case 5:
34
			day = "Thursday";
35
			break;
36
		case 6:
37
			day = "friday";
38
			break;
39
		default:
40
			day = "saturday";
41
			break;
42
		}
43
44
		System.out.println(day);
45
		in.close();
46
	}
47
48
}
49