forked from League-Archive/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMagic8Ball.java
More file actions
46 lines (31 loc) · 884 Bytes
/
Copy pathMagic8Ball.java
File metadata and controls
46 lines (31 loc) · 884 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package DAY4;
import java.util.Random;
import javax.swing.JOptionPane;
public class Magic8Ball {
public static void main(String[] args) {
int number=new Random().nextInt(4);
System.out.println(number);
JOptionPane.showInputDialog("what is your question");
if (number==0){
JOptionPane.showMessageDialog(null, "yes");
}
if (number==1)
{ JOptionPane.showMessageDialog(null, "no");
}
if (number==2){
JOptionPane.showMessageDialog(null, "maybe you should ask Google");
}if(number==3)
{ JOptionPane.showMessageDialog(null, "I do not know");
}
}
public Magic8Ball() {
// TODO Auto-generated constructor stub
// Copyright Wintriss Technical Schools 2013
// 6. If the random number is 1
// -- tell the user "No"
// 7. If the random number is 2
// -- tell the user "Maybe you should ask Google?"
// 8. If the random number is 3
// -- write your own answer
}
}