-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathswitch11.java
More file actions
132 lines (127 loc) · 4.38 KB
/
switch11.java
File metadata and controls
132 lines (127 loc) · 4.38 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
package swichcase;
import java.util.Scanner;
public class switch11 {
public static void main(String[] args) {
Scanner scanner=new Scanner (System.in);
int k1,k2;
System.out.print ("C^:");
char c=scanner.next().charAt (0);
System.out.print ("K1:" );
k1=scanner.nextInt ();
System.out.print ("K2:" );
k2=scanner.nextInt ();
lokation (c,k1,k2);
}
public static void lokation (char c,int k1,int k2){
String sh="Shmol";
String j="Janub";
String g="Garb";
String q="Sharq";
String result="";
switch (k1){
case 0->{
switch (c){
case 's' -> result = q;
case 'j' ->result=g;
case 'g'->result=sh;
case 'q'->result=j;
}System.out.println ("K1:"+result);
switch (k2){
case 0->{
switch (c){
case 's' -> result = j;
case 'j' ->result=sh;
case 'g'->result=q;
case 'q'->result=g;
}
}
case 1->{
switch (c){
case 's' -> result = sh;
case 'j' ->result=j;
case 'g'->result=g;
case 'q'->result=q;
}
}
case 2->{
switch (c){
case 's' -> result = g;
case 'j' ->result=q;
case 'g'->result=j;
case 'q'->result=sh;
}
}
}
}
case 1->{
switch (c){
case 's' -> result = g;
case 'j' ->result=q;
case 'g'->result=j;
case 'q'->result=sh;
}System.out.println ("K1:"+result);
switch (k2){
case 0->{
switch (c){
case 's' -> result = sh;
case 'j' ->result=j;
case 'g'->result=g;
case 'q'->result=q;
}
}
case 1->{
switch (c){
case 's' -> result = j;
case 'j' ->result=sh;
case 'g'->result=q;
case 'q'->result=g;
}
}
case 2->{
switch (c){
case 's' -> result = q;
case 'j' ->result=g;
case 'g'->result=sh;
case 'q'->result=j;
}
}
}
}
case 2->{
switch (c){
case 's' -> result = j;
case 'j' ->result=sh;
case 'g'->result=q;
case 'q'->result=g;
}System.out.println ("K1:"+result);
switch (k2){
case 0->{
switch (c){
case 's' -> result = g;
case 'j' ->result=q;
case 'g'->result=j;
case 'q'->result=sh;
}
}
case 1->{
switch (c){
case 's' -> result =q;
case 'j' ->result=g;
case 'g'->result=sh;
case 'q'->result=j;
}
}
case 2->{
switch (c){
case 's' -> result = sh;
case 'j' ->result=j;
case 'g'->result=g;
case 'q'->result=q;
}
}
}
}
}
System.out.println (result);
}
}