Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
6 changes: 6 additions & 0 deletions 6 Mihir-Amittai ET/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions 17 Mihir-Amittai ET/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Mihir-Amittai ET</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.teachingkidsprogramming.recipes;

import org.teachingextensions.logo.utils.Sounds;
import org.teachingextensions.windows.MessageBox;

import com.spun.util.NumberUtils;

public class ET
{
public static void main(String[] args)
{
int correctNumber = NumberUtils.getRandomInt(1, 100);
int tries = MessageBox.askForNumericalInput("How many tries do you want?");
for (int i = 1; i <= tries; i++)
{
// Choose a random number between 1 and 100 --#4.1 (fake!) & --#13
// Do the following 8 times --#9
int guess = MessageBox.askForNumericalInput("Please guess a number between 1 and 100. You have "
+ (tries + 1 - i) + " tries.");
if (guess == correctNumber)
{
Sounds.playBeep();
MessageBox.showMessage("YOU WINzip :D\n\nYou took " + i + " tries.");
// and exit --#10
System.exit(0);
}
else if (guess > correctNumber)
{
MessageBox.showMessage("You is tooooooo mumbo-jumbo!!!");
}
else if (guess < correctNumber)
{
MessageBox.showMessage("You is toooooo teeny-weeny!!");
}
// If after 8 times they haven't guessed correctly then --#12
// Tell them they've lost the game --#11
}
MessageBox.showMessage("Yu loozez! Sukkah!!! \n\nDa ansah was " + correctNumber);
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
package org.teachingkidsprogramming.recipes;

import org.teachingextensions.logo.utils.Sounds;
import org.teachingextensions.windows.MessageBox;

import com.spun.util.NumberUtils;

public class HiLow
{
public static void main(String[] args)
{
// Choose a random number between 1 and 100 --#4.1 (fake!) & --#13
// Do the following 8 times --#9
// Ask the user for a guess --#1
// If the guess is correct --#4
// Play a bell --#2
// Tell the user that they won the game --#3
// and exit --#10
// Otherwise, if the guess is too high --#6
// Tell the end user that it is too high --#5
// Otherwise, if the guess is too low --#8
// Tell the end user that it is too low --#7
// If after 8 times they haven't guessed correctly then --#12
// Tell them they've lost the game --#11
int correctNumber = NumberUtils.getRandomInt(1, 100);
int tries = MessageBox.askForNumericalInput("How many tries do you want?");
for (int i = 1; i <= tries; i++)
{
int guess = MessageBox.askForNumericalInput("Please guess a number between 1 and 100. You have "
+ (tries + 1 - i) + " tries.");
if (guess == correctNumber)
{
Sounds.playBeep();
MessageBox.showMessage("Your answer was " + correctNumber + "\n\nYOU WINzip :D\n\nYou took " + i
+ " tries.");
System.exit(0);
}
else if (guess > correctNumber)
{
MessageBox.showMessage("You is tooooooo mumbo-jumbo!!!");
}
else if (guess < correctNumber)
{
MessageBox.showMessage("You is toooooo teeny-weeny!!");
}
}
MessageBox.showMessage("Yu loozez! Sukkah!!! \n\nDa ansah was " + correctNumber);
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,51 @@
package org.teachingkidsprogramming.recipes;

import java.awt.Color;

import org.teachingextensions.logo.Colors;
import org.teachingextensions.logo.Tortoise;

public class Houses
{
public static void main(String[] args)
{
// Make the tortoise move as fast as possible --#11
// Have the tortoise start at 200 pixels in on the X axis --#14
// The current height is 40 --#1.2
// drawHouse (recipe below) --#9
// ------------- Recipe for drawHouse --#9
// Change the color of the line the tortoise draws to lightGray --#15
// Move the tortoise the height of a house --#1.1
// Turn the tortoise 90 degrees to the right --#2
// Move the tortoise 30 pixels --#3
// Turn the tortoise 90 degrees to the right --#4
// Move the tortoise the height of a house --#5
// Turn the tortoise 90 degrees to the left --#6
// Move the tortoise 20 pixels --#7
// Turn the tortoise 90 degrees to the left --#8
// ------------- End of drawHouse recipe
// DrawHouse with height 120 (recipe below) --#10
// DrawHouse with height 90 (recipe below) --#12
// DrawHouse with height 20 (recipe below) --#13
Tortoise.setX(200);
int height = 40;
drawHouse(height);
drawHouse(120);
drawHouse(90);
drawHouse(20);
}
private static void drawHouse(int height)
{
Tortoise.setPenColor(colorChooser());
Tortoise.setSpeed(10);
Tortoise.hide();
Tortoise.move(height);
//flatRoof();
//AmittaisRoof;
Tortoise.turn(45);
//move 10
Tortoise.move(10);
//turn 90 right
Tortoise.turn(90);
//move 10
Tortoise.move(10);
//turn 60
Tortoise.turn(45);
Tortoise.move(height);
Tortoise.turn(-90);
Tortoise.move(20);
Tortoise.turn(-90);
}
private static void flatRoof()
{
Tortoise.turn(90);
Tortoise.move(30);
Tortoise.turn(90);
}
private static Color colorChooser()
{
return Colors.Grays.LightGray;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
import junit.framework.Assert;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.teachingextensions.logo.Tortoise;
import org.teachingextensions.logo.Turtle;
import org.teachingextensions.logo.utils.TortoiseUtils;


public class Homework01
{
// 'How to do homework:
Expand All @@ -24,80 +22,80 @@ public class Homework01
@Test
public void numbersDoNotNeedQuotes()
{
Assert.assertEquals(42, ____);
Assert.assertEquals(42, 42);
}
@Test
public void defaultWidthForTheTortoise() throws Exception
{
Assert.assertEquals(Tortoise.getPenWidth(), ____);
Assert.assertEquals(Tortoise.getPenWidth(), 2);
}
@Test
public void stringsNeedQuotes() throws Exception
{
Assert.assertEquals("Green", ___);
Assert.assertEquals("Green", "Green");
}
@Test
public void stringsCanIncludeSpaces() throws Exception
{
Assert.assertEquals("This is a string", ___);
Assert.assertEquals("This is a string", "This is a string");
}
@Test
public void changingThePenWidthTo5() throws Exception
{
Tortoise.setPenWidth(____);
Tortoise.setPenWidth(5);
Assert.assertEquals(5, Tortoise.getPenWidth());
}
@Test
public void movingTheTortoise100Pixels() throws Exception
{
int start = Tortoise.getY();
Tortoise.move(____);
Tortoise.move(100);
Assert.assertEquals(Tortoise.getY(), start - 100);
// 'Hint: make sure you read the name of this method
}
@Test
public void theTortoiseTurns21() throws Exception
{
Tortoise.turn(____);
Tortoise.turn(21);
Assert.assertEquals(21.0, Tortoise.getAngle());
}
@Test
public void theTortoiseTurns15Twice() throws Exception
{
Tortoise.turn(____);
Tortoise.turn(____);
Tortoise.turn(15);
Tortoise.turn(15);
Assert.assertEquals(30.0, Tortoise.getAngle());
}
@Test
public void howFastCanTheTortoiseGo() throws Exception
{
Tortoise.setSpeed(____);
Tortoise.setSpeed(10);
Assert.assertEquals(Tortoise.getSpeed(), topSpeed);
// 'Hint: Click SetSpeed then read the documentation on the left ----->
}
@Test
public void assigningVariables() throws Exception
{
int myFavoriteNumber = 101;
Assert.assertEquals(myFavoriteNumber, ____);
Assert.assertEquals(myFavoriteNumber, 101);
}
@Test
public void combiningNumbers() throws Exception
{
int age = 3 + 4;
Assert.assertEquals(age, ____);
Assert.assertEquals(age, 7);
}
@Test
public void combiningText() throws Exception
{
String name = "Peter" + " " + "Pan";
Assert.assertEquals(name, ___);
Assert.assertEquals(name, "Peter Pan");
}
@Test
public void combiningTextAndNumbers() throws Exception
{
String name = "Henry The " + 8;
Assert.assertEquals(name, ___);
Assert.assertEquals(name, "Henry The 8");
}
@Test
public void combiningTextInALoop() throws Exception
Expand All @@ -107,13 +105,13 @@ public void combiningTextInALoop() throws Exception
{
sound += "H";
}
Assert.assertEquals(sound, ___);
Assert.assertEquals(sound, "AHHH");
}
@Test
public void forLoopsEndAtTheEnd() throws Exception
{
String numbers = "# ";
for (int i = 1; i <= ____; i++)
for (int i = 1; i <= 5; i++)
{
numbers += i;
preventInfiniteLoops();
Expand All @@ -124,7 +122,7 @@ public void forLoopsEndAtTheEnd() throws Exception
public void forLoopsCanStartAnywhere() throws Exception
{
String answer = "Because ";
for (int i = ____; i <= 9; i++)
for (int i = 7; i <= 9; i++)
{
answer += i;
preventInfiniteLoops();
Expand All @@ -136,7 +134,7 @@ public void forLoopsCanStartAnywhere() throws Exception
public void forLoopsCanSkip() throws Exception
{
String numbers = "# ";
for (int i = 1; i <= 20; i += ____)
for (int i = 1; i <= 20; i += 2)
{
numbers = numbers + i + ",";
preventInfiniteLoops();
Expand All @@ -147,7 +145,7 @@ public void forLoopsCanSkip() throws Exception
public void forLoopsCanSkipUpAndDown() throws Exception
{
String numbers = "# ";
for (int i = 20; 0 < i && i <= 40; i += ____)
for (int i = 20; 0 < i && i <= 40; i += -3)
{
numbers = numbers + i + ",";
preventInfiniteLoops();
Expand All @@ -158,7 +156,7 @@ public void forLoopsCanSkipUpAndDown() throws Exception
public void forLoopsCanGoBackwards() throws Exception
{
String numbers = "Countdown: ";
for (int i = 9; i >= 1; i += ____)
for (int i = 9; i >= 1; i += -1)
{
numbers += i;
preventInfiniteLoops();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
package org.teachingkidsprogramming.recipes.quizzes;

import org.teachingextensions.logo.Tortoise;
import org.teachingextensions.windows.MessageBox;
import org.teachingkidsprogramming.recipes.quizzes.graders.HiLowQuizGrader;

public class HiLowQuiz extends org.teachingkidsprogramming.recipes.quizzes.graders.HiLowQuiz
{
public void question1()
{
// if the Y position of the tortoise is 115
if (Tortoise.getY() == 115)
{
Tortoise.turn(63);
}
//
// turn the tortoise to the right 63 degrees
}
public void question2()
{
// if the X position of tortoise is less than Y position of tortoise
if (Tortoise.getX() < Tortoise.getY())
{
Tortoise.turn(-54);
}
//
// turn the tortoise 54 degrees to the left
//
else
{
Tortoise.turn(22);
}
// otherwise turn the tortoise 22 degrees to the right
}
public void question3()
{
// display the message "elcomeway omehay!"
MessageBox.showMessage("elcomeway omehay!");
}
public void question4()
{
// if the Y position of tortoise is greater than 50
if (50 < Tortoise.getY())
{
Tortoise.turn(-177);
}
//
// turn the tortoise 177 degrees to the left
}
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.