-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPaperScissorsRock.java
More file actions
63 lines (42 loc) · 1.17 KB
/
PaperScissorsRock.java
File metadata and controls
63 lines (42 loc) · 1.17 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
import java.util.Scanner;
public class PaperScissorsRock{
public static void main(String[] args){
Scanner bird = new Scanner(System.in);
System.out.print("Enter first player name: ");
String Player1 = bird.nextLine();
System.out.print("Enter second player name: ");
String Player2 = bird.nextLine();
System.out.println("Scissors = 1 Paper = 2 Rock = 0");
System.out.print("Prompt player1 to enter a number: ");
int Number1 = bird.nextInt();
System.out.print("Prompt player2 to enter a number: ");
int Number2 = bird.nextInt();
if (Number1 == 0 && Number2 == 1){
System.out.printf("%s wins", Player1);
}
if (Number1 == 1 && Number2 == 2){
System.out.printf("%s wins", Player1);
}
if (Number1 == 2 && Number2 == 0){
System.out.printf("%s wins", Player1);
}
if (Number1 == 1 && Number2 == 0){
System.out.printf("%s wins", Player2);
}
if (Number1 == 2 && Number2 == 1){
System.out.printf("%s wins", Player2);
}
if (Number1 == 0 && Number2 == 2){
System.out.printf("%s wins", Player2);
}
if (Number1 == 0 && Number2 == 0){
System.out.printf("Draw");
}
if (Number1 == 1 && Number2 == 1){
System.out.printf("Draw");
}
if (Number1 == 2 && Number2 == 2){
System.out.printf("Draw");
}
}
}