-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRockPaperScissor2.java
42 lines (40 loc) · 1008 Bytes
/
RockPaperScissor2.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
public class RockPaperScissor2 {
public static void main(String[] args) {
String input1 = args[0];
String input2 = args[1];
String result;
String one = "Player One win!";
String two = "Player Two win!";
String wgIput = "Wrong Input!!!";
if (input1.equals(input2) && ("p".equals(input1) || "r".equals(input1) || "s".equals(input1))) {
result = "It's Draw";
} else if ("r".equals(input1)) {
if ("p".equals(input2)) {
result = two;
} else if ("s".equals(input2)) {
result = one;
} else {
result = wgIput;
}
} else if ("p".equals(input1)) {
if ("r".equals(input2)) {
result = one;
} else if ("s".equals(input2)) {
result = two;
} else {
result = wgIput;
}
} else if ("s".equals(input1)) {
if ("r".equals(input2)) {
result = two;
} else if ("p".equals(input2)) {
result = one;
} else {
result = wgIput;
}
} else {
result = wgIput;
}
System.out.println(result);
}
}