-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPonte pa esto
More file actions
88 lines (82 loc) · 3.01 KB
/
Ponte pa esto
File metadata and controls
88 lines (82 loc) · 3.01 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
import java.util.*;
public class Rock
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
Random rn = new Random();
String response = " ";
do
{
System.out.println("Let's play: ");
System.out.println("Choose from these options: \n1.Rock\n2.Paper\n3.Scissors\n4.Bye");
int answer = in.nextInt();
int choice = 1 + rn.nextInt(3);
if(answer==1 && choice==2)
{
System.out.println("Your answer: " + answer);
System.out.println("My answer: " + choice);
System.out.println("You Lose!");
}
else if(answer==1 && choice==3)
{
System.out.println("Your answer: " + answer);
System.out.println("My answer: " + choice);
System.out.println("You Win!");
}
else if(answer==1 && choice==1)
{
System.out.println("Your answer: " + answer);
System.out.println("My answer: " + choice);
System.out.println("Tie!");
}
else if(answer==2 && choice==1)
{
System.out.println("Your answer: " + answer);
System.out.println("My answer: " + choice);
System.out.println("You Win!");
}
else if(answer==2 && choice==2)
{
System.out.println("Your answer: " + answer);
System.out.println("My answer: " + choice);
System.out.println("Tie!");
}
else if(answer==2 && choice==3)
{
System.out.println("Your answer: " + answer);
System.out.println("My answer: " + choice);
System.out.println("You Lose!");
}
else if(answer==3 && choice==1)
{
System.out.println("Your answer: " + answer);
System.out.println("My answer: " + choice);
System.out.println("You Lose!");
}
else if(answer==3 && choice==2)
{
System.out.println("Your answer: " + answer);
System.out.println("My answer: " + choice);
System.out.println("You win!");
}
else if(answer==3 && choice==3)
{
System.out.println("Your answer: " + answer);
System.out.println("My answer: " + choice);
System.out.println("Tie!");
}
else if(answer==4)
{
System.out.println("Bye!");
break;
}
System.out.println("Do you wanna go again?");
response = in.next();
if(response.toUpperCase().equals("NO"))
{
System.out.println("Bye");
}
}while(response.toUpperCase().equals("YES"));
}
}