Results 1 to 10 of 10
  1. #1
    youngflames is offline Member
    Join Date
    Jan 2010
    Posts
    6
    Rep Power
    0

    Default 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. #2
    sky
    sky is offline Member
    Join Date
    Nov 2009
    Posts
    96
    Rep Power
    0

    Default

    I think that everybody is wondering: what is your question?

  3. #3
    youngflames is offline Member
    Join Date
    Jan 2010
    Posts
    6
    Rep Power
    0

    Default

    My house is sitting to the left of my roof. Also where should I start with the 2 two windows and door

  4. #4
    sky
    sky is offline Member
    Join Date
    Nov 2009
    Posts
    96
    Rep Power
    0

    Default

    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. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by sky View Post
    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. #6
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default

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

    Default

    Quote Originally Posted by Fubarable View Post
    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. #8
    youngflames is offline Member
    Join Date
    Jan 2010
    Posts
    6
    Rep Power
    0

    Default

    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. #9
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default

    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. #10
    youngflames is offline Member
    Join Date
    Jan 2010
    Posts
    6
    Rep Power
    0

Similar Threads

  1. Replies: 0
    Last Post: 12-01-2009, 01:04 PM
  2. problems with connecting to Oracle DB in NetBeans
    By m16k2002 in forum Web Frameworks
    Replies: 6
    Last Post: 03-25-2009, 10:14 AM
  3. hello the community & mysql connecting problems
    By scchia in forum New To Java
    Replies: 6
    Last Post: 07-16-2008, 08:49 AM
  4. building a house
    By dc2acgsr99 in forum Java Applets
    Replies: 4
    Last Post: 03-07-2008, 11:18 PM
  5. Replies: 0
    Last Post: 08-07-2007, 07:01 AM

Posting Permissions

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