-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDayCalculator.java
More file actions
51 lines (44 loc) · 1.02 KB
/
DayCalculator.java
File metadata and controls
51 lines (44 loc) · 1.02 KB
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
import java.util.Scanner; // input
// DONE
public class DayCalculator {
public static void main(String[] args)
{
Scanner obj = new Scanner(System.in);
int day;
// PROMPT
do {
System.out.print(" Enter Day : ");
day = obj.nextInt();
} while (day < 1 || day > 7);
// CONDITIONS
if (day == 1)
{
System.out.println(" MONDAY ");
}
if (day == 2)
{
System.out.println(" TUESDAY ");
}
if (day == 3)
{
System.out.println(" WEDNESDAY ");
}
if (day == 4)
{
System.out.println(" THURSDAY ");
}
if (day == 5)
{
System.out.println(" FRIDAY ");
}
if (day == 6)
{
System.out.println(" SATURDAY ");
}
if (day == 7)
{
System.out.println(" SUNDAY ");
}
obj.close(); // closing scanner object as this is end now
}
}