-
Notifications
You must be signed in to change notification settings - Fork 0
/
Magic8ball.java
55 lines (52 loc) · 1.75 KB
/
Magic8ball.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
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.util.Random;
public class Magic8ball {
public static void main(String[]args)
{
Random r = new Random();
int choice = 1 + r.nextInt(20);
String response = "";
if(choice == 1)
response = "It is certain";
else if(choice == 2)
response = "It is decidedly so";
else if(choice == 3)
response = "Without a doubt";
else if(choice == 4)
response = "Yes - definitely";
else if(choice == 5)
response = "You may rely on it";
else if(choice == 6)
response = "As I see it, yes";
else if(choice == 7)
response = "Most likely";
else if(choice == 8)
response = "Outlook good";
else if(choice == 9)
response = "Signs point to yes";
else if(choice == 10)
response = "Yes";
else if(choice == 11)
response = "Reply hazy, try again";
else if(choice == 12)
response = "Ask again later";
else if(choice == 13)
response = "Better not tell you now";
else if(choice == 14)
response = "Cannot predict now";
else if(choice == 15)
response = "Concentrate and ask";
else if(choice == 16)
response = "Don't count on it";
else if(choice == 17)
response = "My reply is no";
else if(choice == 18)
response = "My sources say no";
else if(choice == 19)
response = "Outlook not so good";
else if(choice == 20)
response = "Very doubtful";
else
response = "8-ball ERROR!";
System.out.println("MAGIC 8-BALLS SAYS: " + response);
}
}