Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified TeachingKidsProgramming/src/jars/TeachingKidsProgramming.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
package org.teachingkidsprogramming.recipes;

import org.teachingextensions.simpleparser.Parser;
import org.teachingextensions.utils.Viewer;
import org.teachingextensions.windows.MessageBox;

public class AdLibs
{
public static void main(String[] args)
{
//Ask the user to enter an adverb, save it as currentAdverb --#2
Words words = new Words();
words.adverb = MessageBox.askForTextInput("Please enter an adverb ");
//Ask the user to enter a verb ending in '-ed', save it as currentEdVerb --#4
words.verb = "";
forceEd(words);
//Ask the user to enter a body part, save it as currentBodyPart --#6
//Set the value of the currentStory to the word "Today " --#1.2
//Add the words "I woke " + currentAdverb + ". " to the currentStory --#3
//Add the words '"Then I " + currentEdVerb + " " to the currentStory --#5
//Add the words "my " + currentBodyPart + ". " to the current story --#7
//Show the currentStory in a message box as a message --#1.1
words.currentBodyPart = MessageBox.askForTextInput("Please state a boday part.");
String story = Parser.parseRtfFile("view.rtf", words);
// MessageBox.showMessage(words.currentStory);
Viewer.displayRtfFile(story);
System.exit(0);
}
private static void forceEd(Words words)
{
while (words.verb.equals(""))
{
String verb = MessageBox.askForTextInput("Please enter a verb ending in \"ed\"");
if (verb.endsWith("ed"))
{
words.verb = verb;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.teachingkidsprogramming.recipes;

public class Words
{
public String adverb, verb, currentBodyPart, currentStory;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import org.teachingkidsprogramming.recipes.quizzes.graders.PentagonCrazyQuizGrader;
import org.teachingkidsprogramming.recipes.quizzes.graders.PentagonQuiz;

public class PentagonCrazyQuiz extends PentagonCrazyQuizGrader
public class PentagonCrazyQuiz extends PentagonQuiz
{
// Question1
// Create a method called thread
// that moves the tortoise 6 pixels
public void question2()
{
// Do the following 76 times
// Quiz.Stitch()
// call stitch
// Repeat
}
public void question3()
Expand All @@ -24,6 +24,6 @@ public void question4()
}
public static void main(String[] args)
{
new PentagonCrazyQuizGrader().grade(new PentagonQuiz());
new PentagonCrazyQuizGrader().grade(new PentagonCrazyQuiz());
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package org.teachingkidsprogramming.recipes.quizzes;

import org.teachingkidsprogramming.recipes.quizzes.graders.HousesQuizGrader;
import org.teachingkidsprogramming.recipes.quizzes.graders.SpiderQuiz;
import org.teachingkidsprogramming.recipes.quizzes.graders.SpiderWebQuizGrader;

public class SpiderWebQuiz extends SpiderWebQuizGrader
public class SpiderWebQuiz extends SpiderQuiz
{
public double length = 1;
public int number = 1;
public void question1()
{
// Do the following the current number of times
for (int i = 1; i <= i; i++)
{
circle();
}
// Call circle()
// Repeat
}
Expand Down Expand Up @@ -38,6 +40,6 @@ public void question1()
//
public static void main(String[] args)
{
new HousesQuizGrader().grade(new HousesQuiz());
new SpiderWebQuizGrader().grade(new SpiderWebQuiz());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.teachingkidsprogramming.recipes.quizzes.graders;

import java.awt.Color;
import java.awt.Graphics2D;

import org.teachingextensions.logo.ColorWheel;
Expand Down Expand Up @@ -72,13 +73,24 @@ private boolean grade3Lime()
{
ColorWheel.removeAllColors();
quiz.question3();
return ColorWheel.getNextColor() == Colors.Greens.Lime;
return getSafeColor() == Colors.Greens.Lime;
}
public Color getSafeColor()
{
try
{
return ColorWheel.getNextColor();
}
catch (Exception e)
{
return null;
}
}
private boolean grade4Red()
{
ColorWheel.removeAllColors();
quiz.question4();
return ColorWheel.getNextColor() == Colors.Reds.Red;
return getSafeColor() == Colors.Reds.Red;
}
public void setColors()
{
Expand All @@ -94,7 +106,7 @@ public void stitch()
}
else
{
Tortoise.setPenColor(ColorWheel.getNextColor());
Tortoise.setPenColor(getSafeColor());
Tortoise.turn(wheel.next());
Tortoise.penDown();
quiz.thread();
Expand Down
Binary file not shown.