# building a house but having problems connecting it

• 01-24-2010, 11:57 PM
youngflames
building a house but having problems connecting it
import Guzdial.*;

/**
* Course: ....
* Section: .....
* Professor: ......
* Name: .....
* Assignment #: ......
*/

public class House
{
static World earth;
static Turtle turtle;

static void house()
//It builds a house
{
earth = new World();
turtle = new Turtle(earth);
rectangle(100,100); //Draws a rectangle of 200 x 100
equilateral (100); //Draws equilateral triangle of 100 on each side
}
//Draws four sides of a rectangle of a given width and height
static void rectangle(int width, int height)
{
turtle.forward(height);
turtle.turnRight();
turtle.forward(width);
turtle.turnRight();
turtle.forward(height);
turtle.turnRight();
turtle.forward(width);
turtle.turnRight();
}

//Draws three sides of a equilateral triangle of a given length
static void equilateral(int length)
{
turtle.forward(100);
turtle.penUp();
turtle.forward(100);
turtle.turn(72);
turtle.penDown();

turtle.penUp();
turtle.forward(100);
turtle.turn(72);
turtle.penDown();

turtle.penUp();
turtle.forward(100);
turtle.turn(72);
turtle.penDown();

turtle.penUp();
turtle.forward(100);
turtle.turn(54);
turtle.penDown();

turtle.turn(120);
turtle.forward (100);
turtle.turn(120);
turtle.forward(100);
}
}
• 01-25-2010, 12:47 AM
sky
I think that everybody is wondering: what is your question?
• 01-25-2010, 01:18 AM
youngflames
My house is sitting to the left of my roof. Also where should I start with the 2 two windows and door
• 01-25-2010, 03:44 AM
sky
Post the code of the classes Turtle and World, please (using also the code tag). In other words, post some code that can be compiled an run.
• 01-25-2010, 03:50 AM
Fubarable
Quote:

Originally Posted by sky
Post the code of the classes Turtle and World, please (using also the code tag). In other words, post some code that can be compiled an run.

The Turtle code is likely part of a 3rd party library, probably a Jar file that he may not have the rights to post.
• 01-25-2010, 04:27 AM
My guess is that you're not understanding the coordinate system in java or the turtle software. By default, java draws from top to bottom as the Y coord increases, and left to right as X increases, but your drawing package might be different. Perhaps you are not starting the drawing of your shapes where you think you are?
• 01-25-2010, 02:40 PM
sky
Quote:

Originally Posted by Fubarable
The Turtle code is likely part of a 3rd party library, probably a Jar file that he may not have the rights to post.

He maybe can upload the jar file so we can run the code.
• 01-26-2010, 12:15 AM
youngflames
I dont know what jar files are but here are the directions: Please help because it due by midnight...I've been working on this for 4 days now

Create a Java class file (source file) using BlueJ named House.java. In this class you will have the following three methods:
house()
rectangle()
equilateral()
The rectangle() and equilateral() method will work as they did for the versions you did in the Lab. The house() method will draw a house, and it must call the rectangle() and equilateral() methods while it is doing so. The house drawn must have a triangular roof, a rectangular base, and a door and two windows. Your house() method will serve the same function as your draw() method served in the last Lab, although in your house() method you will need to determine precisely where you want the turtle to go before it draws the equilateral triangle that will serve as the roof of the house, and before it draws the rectangles which will serve as the base of the house, the door and the two windows. Be sure your program compiles and runs without error.
Be sure your program compiles and runs without error.

Assignment Due: January 25, 2010 by 11:59 P
• 01-26-2010, 08:06 AM