-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconditional.java
More file actions
156 lines (140 loc) · 4.6 KB
/
Copy pathconditional.java
File metadata and controls
156 lines (140 loc) · 4.6 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import java.util.*;
public class conditional
{
public static void main(String args[])
{
// int age = 16;
// if(age>=18)
// {
// System.out.println("adult : drive, vote");
// }
// if(age>13 && age<18)
// {
// System.out.println("teenager");
// }
// else{
// System.out.println("no adult");
// }
// }
// {
// int i = 1;
// int j = 9;
// if(i>= j)
// {
// System.out.println("i is largest of two");
// }else{
// System.out.println("j is largest of two");
// }
// }
// {
// Scanner sc = new Scanner(System.in);
// int number = sc.nextInt();
// if (number % 2 == 0) {
// System.out.println("Even");
// } else {
// System.out.println("Odd");
// }
// }
// {
// Scanner sc = new Scanner(System.in);
// int income = sc.nextInt();
// int tax;
// if(income < 500000){
// tax= 0;
// }
// else if(income>= 500000 && income<1000000)
// {
// tax = (int)(income*0.2);
// }
// else{
// tax = (int)(income*0.3);
// }System.out.println("your tax is: "+tax);
// }
// {
// int A = 3;
// int B = 5;
// int C = 8;
// if(A>B && A>C)
// {
// System.out.println("A is Greatest of three");
// }
// else if(B>A && B>C)
// {
// System.out.println("B is Greatest of three");
// }
// else{
// System.out.println("C is Greatest of three");
// }
// }
// {
// int number = 4;
// // ternary operator
// String type = ((number %2)==0)? "even":"odd";
// System.out.println(type);
// }
// switch case statement
// {
// int number =2;
// switch(number)
// {
// case 1: System.out.println("Samosa");
// break;
// case 2: System.out.println("Burger");
// break;
// case 3: System.out.println("AAlo banda");
// break;
// default : System.out.println("We wake up");
// }
// }
// Scanner sc = new Scanner(System.in);
// System.out.println("Enetr value of a : ");
// int a = sc.nextInt();
// System.out.println("Enetr value of b : ");
// int b = sc.nextInt();
// System.out.println("Enter operator : ");
// char operator = sc.next().charAt(0);
// switch (operator) {
// case '+': System.out.println(a+b);
// break;
// case '-': System.out.println(a-b);
// break;
// case '*': System.out.println(a*b);
// break;
// case '/': System.out.println(a/b);
// break;
// case '%': System.out.println(a%b);
// break;
// default: System.out.println("Wrong Operator");
// break;
// }
Scanner sc = new Scanner(System.in);
/* Input week number from user */
System.out.println("Enter week number(1-7): ");
int week = sc.nextInt();
switch(week) {
case 1:
System.out.println("Monday");
break;
case 2:
System.out.println("Tuesday");
break;
case 3:
System.out.println("Wednesday");
break;
case 4:
System.out.println("Thursday");
break;
case 5:
System.out.println("Friday");
break;
case 6:
System.out.println("Saturday");
break;
case 7:
System.out.println("Sunday");
break;
default:
System.out.println("Invalid input! Please enter week number between1-7.");
}
}
}