Skip to content

Commit 7004c6d

Browse files
committed
Updated from Central
1 parent f1871e6 commit 7004c6d

3 files changed

Lines changed: 2 additions & 32 deletions

File tree

.classpath

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
<classpathentry kind="lib" path="en_us.jar"/>
1212
<classpathentry kind="lib" path="freetts-jsapi10.jar"/>
1313
<classpathentry kind="lib" path="freetts.jar"/>
14+
<classpathentry kind="lib" path="game_tools_0.1.4.jar"/>
1415
<classpathentry kind="output" path="bin"/>
1516
</classpath>

game_tools_0.1.4.jar

15.7 KB
Binary file not shown.
Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package zebra.section4;
22

3-
import javax.swing.JOptionPane;
4-
53
public class StephenHawking {
64

75
// 1. make a main method and put steps 2, 3, 4 and 5 inside it
@@ -10,41 +8,12 @@ public class StephenHawking {
108
// Example: String sentence = "My favorite food is broccoli!";
119

1210

13-
// 3. Use the speak() method and pass it the sentence. Then run your program. Do you hear it?
11+
// 3. Use the Sound.speak() method and pass it the sentence. Then run your program. Do you hear it?
1412

1513
// 4. Change the code you wrote in step 2 to ask the user for a sentence.
1614
// hint: JOptionPane.showInputDialog("Write something here!");
1715

1816

1917
// 5. Make steps 3 repeat a BUNCH OF TIMES (hint: use a while loop)
2018

21-
22-
23-
24-
25-
26-
27-
28-
29-
30-
/* Don't change this. */
31-
static void speak(String words) {
32-
33-
if (System.getProperty("os.name").contains("Windows")) {
34-
String cmd = "PowerShell -Command \"Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('"
35-
+ words + "');\"";
36-
try {
37-
Runtime.getRuntime().exec(cmd).waitFor();
38-
} catch (Exception e) {
39-
e.printStackTrace();
40-
}
41-
} else {
42-
try {
43-
Runtime.getRuntime().exec("say " + words).waitFor();
44-
} catch (Exception e) {
45-
e.printStackTrace();
46-
}
47-
}
48-
}
49-
5019
}

0 commit comments

Comments
 (0)