Skip to content

Commit bb963b4

Browse files
committed
added documentation to new Sound class and cleaned
1 parent cb9078e commit bb963b4

6 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/main/java/org/teachingextensions/logo/Sound.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ public enum TKPSound {
3030
LosingPower, Malfunction, Pizza, RunAway, SheerIgnorance, SoBeIt, StrangePerson, Stubborn, Yahoo, Yay
3131
}
3232
private String soundFilename = null;
33+
/**
34+
* Sets a sound that you can play through your speakers.
35+
* Use a TKPSound (there is a list)<br>
36+
* <b>Example:</b> {@code Sound.setSound(TKPSound.Ahem)}
37+
*/
3338
public synchronized void setSound(TKPSound mySound)
3439
{
3540
String sound = "soundFiles/" + mySound + ".wav";
@@ -43,8 +48,9 @@ public synchronized void setSound(TKPSound mySound)
4348
this.soundFilename = this.soundFilename.replace("file:", "");
4449
}
4550
/**
46-
* Plays a sound through your speakers. Use a '.wav' file<br>
47-
* <b>Example:</b> {@code Sound.playSound("mySound.wav")}
51+
* Plays a TKPSound through your speakers.
52+
* You must first set the TKPSound <br>
53+
* <b>Example:</b> {@code Sound.playSound()}
4854
*/
4955
public synchronized void playSound()
5056
{

src/main/java/org/teachingextensions/logo/Tortoise.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ public static void drawShape(int sides, Color color, int length, int width)
322322
VirtualProctor.setClassName("Grace Hopper's Class");
323323
VirtualProctor.setName("Jean Bartik");
324324
}
325+
/**
326+
* Draws an entire Tortoise -- fast!
327+
* <div><b>Example: </b> {@code tortoise.drawTortoise()}</div>
328+
*/
325329
public static void drawTortoise()
326330
{
327331
Tortoise.show();

src/main/java/org/teachingextensions/logo/Turtle.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,13 @@ public TurtlePanel getBackgroundWindow()
245245
{
246246
return (TurtlePanel) getPanel();
247247
}
248+
/**
249+
* Sets the animal
250+
* <p><b>Example:</b> {@code myTurtle.setAnimal(Animals.spider)}</p>
251+
*
252+
* @param animal
253+
* The type of animal that appears on your window
254+
*/
248255
public void setAnimal(Animals animal)
249256
{
250257
refreshPanel();
@@ -326,7 +333,7 @@ public boolean isDead()
326333
return this.animal == Animals.ExplodedTurtle;
327334
}
328335
/**
329-
* Current types are: ExplodedTurtle, Turtle, Spider
336+
* Current types are: ExplodedTurtle, Turtle, Spider, Unicorn
330337
*/
331338
public enum Animals {
332339
ExplodedTurtle, Turtle, Spider, Unicorn

src/main/java/org/teachingkidsprogramming/recipes/completed/section00demos/RecipeForTestingVirtualProctor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void main(String[] args) throws Exception
2222
Tortoise.move(75);
2323
Tortoise.turn(360 / sides);
2424
Sound s = new Sound();
25-
s.setSound(Sound.TKPSound.SoBeIt);
25+
s.setSound(Sound.TKPSound.BrainIsGone);
2626
s.playSound();
2727
}
2828
VirtualProctor.setClassName("TKPHouseAtHome");

src/main/java/org/teachingkidsprogramming/recipes/completed/section06modelviewcontroller/ExceptionalAdLibsVariation.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
import org.teachingextensions.logo.utils.EventUtils.MessageBox;
44

5-
//***********this recipe is in development - watch for updates!**************
65
public class ExceptionalAdLibsVariation
76
{
87
public static void main(String[] args)
98
{
10-
// Ask the user to enter an adverb, save it as currentAdverb --#2
119
String adverb = MessageBox.askForTextInput("What is the adverb?");
1210
if (adverb.isEmpty())
1311
{
@@ -20,7 +18,6 @@ else if (adverb.matches("[\\d]*"))
2018
return;
2119
}
2220
String currentAdverb = adverb;
23-
// Ask the user to enter a verb ending in '-ed', save it as currentEdVerb --#4
2421
String edverb = MessageBox.askForTextInput("What is the -ed verb?");
2522
if (edverb.isEmpty())
2623
{
@@ -33,7 +30,6 @@ else if (edverb.matches("[\\d]*"))
3330
return;
3431
}
3532
String currentEdVerb = edverb;
36-
// Ask the user to enter a body part, save it as currentBodyPart --#6
3733
String bodyPart = MessageBox.askForTextInput("What is the body part?");
3834
if (bodyPart.isEmpty())
3935
{
@@ -46,15 +42,10 @@ else if (bodyPart.matches("[\\d]*"))
4642
return;
4743
}
4844
String currentBodyPart = bodyPart;
49-
// Set the value of the currentStory to the word "Today " --#1.2
5045
String currentStory = "Today ";
51-
// Add the words "I woke " + currentAdverb + ". " to the currentStory --#3
5246
currentStory = currentStory + "I woke " + currentAdverb + ". ";
53-
// Add the words '"Then I " + currentEdVerb + " " to the currentStory --#5
5447
currentStory = currentStory + "Then I " + currentEdVerb + " ";
55-
// Add the words "my " + currentBodyPart + ". " to the current story --#7
5648
currentStory = currentStory + "my " + currentBodyPart + ". ";
57-
// Show the currentStory in a message box as a message --#1.1
5849
MessageBox.showMessage(currentStory);
5950
}
6051
}

src/main/java/org/teachingkidsprogramming/recipes/completed/section06modelviewcontroller/OneFishTwoFish.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.Iterator;
44
import java.util.Scanner;
55

6-
//**In Development**//
6+
//*************This Lesson is In Development*****************************//
77
public class OneFishTwoFish
88
{
99
private static Scanner scanner;
@@ -13,7 +13,6 @@ public static void main(String[] args)
1313
int fish = -10;
1414
howManyFish(fish);
1515
}
16-
//
1716
public static void makeAString()
1817
{
1918
final String input = "1 fish 2 fish red fish blue fish,black fish,blue fish,old fish,new fish ";

0 commit comments

Comments
 (0)