File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 11package zebra .section4 ;
22
3- import javax .swing .JOptionPane ;
4-
53public 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}
You can’t perform that action at this time.
0 commit comments