Results 1 to 11 of 11
  1. #1
    JAVA-Noobie is offline Member
    Join Date
    May 2015
    Posts
    4
    Rep Power
    0

    Default Need help with greenfoot project

    Hi I am new to java and having trouble with a project I am doing.

    I'm not sure how to go about doing this problem.

    Need help with greenfoot project-prac6.png

    These are the commands Clara can use.

    turnLeft(); - Clara turns 90 degrees to the left
    move();+++++++++++++++++++++++++ - Clara moves one step forward in the direction she is currently facing
    putLeaf();++++++++++++++++++++++ - Clara puts one leaf at her current position
    removeLeaf();++++++++++++++ - Clara removes a leaf at her current position

    turnRight();++++++++++++++ - Clara turns 90 degrees to the right
    onLeaf();+++++++++++++++++++++++++++ - Returns true if Clara is positioned on top of a leaf or false otherwise
    treeFront();++++++++++++++ - Returns true if there is a tree one step ahead in the direction Clara faces or false otherwise
    treeLeft();+++++++++++++++++++++++++++ - Returns true if there is a tree to the left from Clara or false otherwise
    treeRight();+++++++++++++++++++++++++++ - Returns true if there is a tree to the right from Clara or false otherwise
    mushroomFront();+++++++++++++++++++++++++++ - Returns true if there is a tree to the right from Clara or false otherwise
    readInt(String+text);+++++++++++++++++++++++++++ - Allows user to enter an integer number from keyboard, returns the entered number
    readDouble(String+text);++++++++++++++++++++++++++ + - Allows user to enter a real number from keyboard, returns the entered number

    Any help would be greatly appreciated.
    Last edited by JAVA-Noobie; 05-07-2015 at 09:29 AM.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Need help with greenfoot project

    Surely you know how to at least start? The assignment also seems to want you to actually draw that screen, so you must have learned how to do such things? I'd say step one is to get at least as far as to produce that 'initial screen', at that point you don't even have to implement any of the 'commands' listed there yet. Then start implementing everything one at a time.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    JAVA-Noobie is offline Member
    Join Date
    May 2015
    Posts
    4
    Rep Power
    0

    Default Re: Need help with greenfoot project

    Yeah I know how to do the first part which is to create a basket but I don't know what to write so I can place the leaves like that.

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Need help with greenfoot project

    ... and you also don't know how to learn to do that?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    JAVA-Noobie is offline Member
    Join Date
    May 2015
    Posts
    4
    Rep Power
    0

    Default Re: Need help with greenfoot project

    Quote Originally Posted by gimbal2 View Post
    ... and you also don't know how to learn to do that?
    No I haven't learned it could you please enlighten me?

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Need help with greenfoot project

    I wouldn't know where to begin, I'm not trained to help people who just dump their homework and then say "help me" without explaining anything about what they know already and what they have done so far themselves to work on the problem.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    trcooke is offline Tim Cooke
    Join Date
    Jul 2014
    Location
    Belfast
    Posts
    101
    Rep Power
    0

    Default Re: Need help with greenfoot project

    gimbal, just to let you know that Greenfoot (Greenfoot) is a programming learning framework aimed at 14yrs+ age group. So I think you get a lot of the initial setup and 'hard' graphics stuff for free, which leaves the learner to play around with the programming steps required to move an avatar around the screen, do things, and respond to events such as collisions with other items on the canvas. I saw a demo by one of the Greenfoot developers from the University of Kent last year, it's pretty cool.

    I wanted to mention that so we don't get caught up with trying to create the initial canvas from nothing.

  8. #8
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Need help with greenfoot project

    That at least explains something. So basically you're trying to do something cool you found on the net that is part of a training program, without actually being in the training program?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    JAVA-Noobie is offline Member
    Join Date
    May 2015
    Posts
    4
    Rep Power
    0

    Default Re: Need help with greenfoot project

    Quote Originally Posted by gimbal2 View Post
    That at least explains something. So basically you're trying to do something cool you found on the net that is part of a training program, without actually being in the training program?
    No I'm not tryna do something cool, I'm trying to finish this project and I am part of the training program.

    In the first part the user has to enter the length and width with which to create the basket, I've done that part by using a for loop, I was just wondering how I would go about placing the leaves in that position no matter the length and width of the basket.
    Last edited by JAVA-Noobie; 05-07-2015 at 03:12 PM.

  10. #10
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Need help with greenfoot project

    Well that's a little bit more information again, apparently you already have done something and you know how to use a for loop.

    Drawing a cake that "scales" with the size of the basket is the ultimately end result. As a simpler step in between I would first try to write some code which produces the cake exactly as it is in the picture and worry about the variable width and height later. So try to draw a cake that is 20 cells wide and 7 cells high.

    If you look at the picture you can see that the cake basically consists of four individual components;

    - it has a solid edge on the left side
    - it has an edge on the right side
    - it has an edge on the bottom
    - it has a checkered pattern in the center

    As an even simpler first step, could you write code to produce only the checkered pattern without the edges? If you have that start, you may find it easier to do the rest of the cake too.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  11. #11
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: Need help with greenfoot project

    And should it ever come up, Karel is another one. Karel (programming language) - Wikipedia, the free encyclopedia. There is also a Java version which simply uses canned method calls to move around the grid, detect objects and edges, and so forth.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Greenfoot: Need help with my Pinball game
    By BradM313 in forum New To Java
    Replies: 2
    Last Post: 02-26-2013, 03:41 PM
  2. Greenfoot help
    By Big-D in forum New To Java
    Replies: 2
    Last Post: 05-17-2012, 03:24 PM
  3. Greenfoot exporting in .jar?
    By sciguy77 in forum New To Java
    Replies: 0
    Last Post: 01-18-2009, 07:06 PM
  4. Greenfoot 1.4.1
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 03-24-2008, 06:02 PM
  5. Greenfoot 1.2.1
    By Jamie in forum Java Software
    Replies: 0
    Last Post: 06-14-2007, 02:54 PM

Posting Permissions

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