forked from alexlorenlee/JavaTutorialCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagicBall.java
More file actions
32 lines (24 loc) · 676 Bytes
/
MagicBall.java
File metadata and controls
32 lines (24 loc) · 676 Bytes
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
import java.util.Random;
import java.util.Scanner;
public class MagicBall {
public static void main(String[] args) {
System.out.println("Enter your question");
Scanner scan = new Scanner(System.in);
scan.next();
scan.close();
Random rand = new Random();
int r = rand.nextInt(5);
System.out.println(r);
if(r == 0) {
System.out.println("As I see it, yes.");
} else if(r == 1) {
System.out.println("Signs point to yes.");
} else if(r == 2) {
System.out.println("Reply hazy, try again.");
} else if(r == 3) {
System.out.println("Don't count on it.");
} else if(r == 4) {
System.out.println("Outlook not so good.");
}
}
}