forked from League-Archive/IntroToJavaWorkshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjug.java
More file actions
30 lines (20 loc) · 647 Bytes
/
Copy pathjug.java
File metadata and controls
30 lines (20 loc) · 647 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
import java.io.IOException;
import javax.swing.JOptionPane;
public class jug {
// 1. make a main method and put steps 2, 3 & 4 inside it
public static void main(String[] args) {
for (int i = 0; i < 15; i++) {String question = JOptionPane.showInputDialog(null, "input a sentince, plese");
speak(question);
}
String question = JOptionPane.showInputDialog(null, "input a sentince, plese");
}
// 4. repeat steps 2 and 3 a lot of times
/* Don’t change this…. */
static void speak(String words) {
try {
Runtime.getRuntime().exec("say " + words).waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
}