# Thread: building a house but having problems connecting it

1. Member
Join Date
Jan 2010
Posts
6
Rep Power
0

## 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);
}
}

2. Member
Join Date
Nov 2009
Posts
96
Rep Power
0
I think that everybody is wondering: what is your question?

3. Member
Join Date
Jan 2010
Posts
6
Rep Power
0
My house is sitting to the left of my roof. Also where should I start with the 2 two windows and door

4. Member
Join Date
Nov 2009
Posts
96
Rep Power
0
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.

5. 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.

6. 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?

7. Member
Join Date
Nov 2009
Posts
96
Rep Power
0
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.

8. Member
Join Date
Jan 2010
Posts
6
Rep Power
0
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

9. oh haha! Yeah, this is one of the famous bluej tutorials. Bluej comes with a pre-made house when you download the tutorial files. Perhaps you could look at those and see what you're doing wrong? I'm convinced you're drawing your rectangles backwards or something simple like that. You could always post a link to your bluej project for us to see.

10. Member
Join Date
Jan 2010
Posts
6
Rep Power
0
How do I post a link to you?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•