Results 1 to 16 of 16
Like Tree2Likes
  • 1 Post By blackhawk01
  • 1 Post By JosAH

Thread: New to Java and this forum need some help.

  1. #1
    blackhawk01 is offline Member
    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0

    Default New to Java and this forum A program I need to write but can't figure out

    I see that this exact problem has been put here before but can not figure it out. Here is my problem
    The Toys of the Future Company has decided to issue a new line of toy robots. While they are not sure exactly what their robots will look like, they do know the functionality that they will all have. All robots will be able to move forward, turn right, turn left, spin and detect an object in front of it via a sensor. The robot will use a touch sensor to determine whether it has hit an object in front of it, such as a wall. The robot will have two, three, or four wheels, but it will only be driven by two of them: a right wheel and a left wheel. Each wheel will be attached to a motor that controls it.

    write a program for your robot that allows it to move in a large square. Allow your robot to run in a big two dimensional array and every time the robot encounters a square in your array, turn that square black.

    I am in my 4th week of doing this and this is way over my head I am taking java online and get no help from the instructor. I don't even know where to start except I have written out my objects and actions but not sure how to get them into code. I have started some work in Eclipse and can paste it if requested. Just a class no main class yet.
    Last edited by blackhawk01; 03-15-2015 at 04:51 AM.

  2. #2
    blackhawk01 is offline Member
    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0

    Default Re: New to Java and this forum need some help.

    I have requested help from all my classmates and we are all in the same boat. This instructor sucks.

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: New to Java and this forum need some help.

    Is this to be a GUI program or console?
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    blackhawk01 is offline Member
    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0

    Default Re: New to Java and this forum need some help.

    GUI is introduced in this chapter but I believe she wants it to run on the console
    Develop your new class.
    Create a new NetBeans® project entitled, "Assignment_7_1" and develop your new class. Now, using the objects and classes that you have written, write a program for your robot that allows it to move in a large square. Allow your robot to run in a big two dimensional array and every time the robot encounters a square in your array, turn that square black.
    Step 4Develop a framework application.
    Develop a framework application to implement your new class. Your framework application should test and demonstrate all the functionality of your class. Take a screen shot your NetBeans® IDE showing the output from your Java program

    This is my intstuctions

  5. #5
    blackhawk01 is offline Member
    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0

    Default Re: New to Java and this forum need some help.

    total instructions.

    Consider the scenario.
    The Toys of the Future Company has decided to issue a new line of toy robots. While they are not sure exactly what their robots will look like, they do know the functionality that they will all have. All robots will be able to move forward, turn right, turn left, spin and detect an object in front of it via a sensor. The robot will use a touch sensor to determine whether it has hit an object in front of it, such as a wall. The robot will have two, three, or four wheels, but it will only be driven by two of them: a right wheel and a left wheel. Each wheel will be attached to a motor that controls it.

    TIP:
    1. Start by reading your assignment question.

    2. In the assignment question, look for the behaviors that your Robot is suppose to do like turning left. These behaviors will be your methods. Create one method for each behavior turn left, turn right, spin, move forward, and detect.

    3. Now look for properties that your Robot should have like the number of wheels on the left and right. These will be your data fields.

    4. Add a MAIN method inside your public class Robot to execute the methods. Look at page 326 to see how a main method is implemented inside a class you’re creating.

    The "sensor" word here is very helpful. You'll need to create a variable called sensor. You can make that a boolean variable and set it to true if it's detecting an object.

    Assignment question includes: "The robot will use a touch sensor to determine whether it has hit an object in front of it, such as a wall.

    >> You could create a method that turns the sensor on if it detects a wall.
    Then create another method that checks if the sensor variable is on, or true.

    Assignment also says: "The robot will have two, three, or four wheels, but it will only be driven by two of them: a right wheel and a left wheel. Each wheel will be attached to a motor that controls it."

    >> Use data fields for these properties of the robots such as rightWheel and leftWheel.
    Remember that you will need to create an additional constructor that allows you to create
    a Robot object with different numbers of right wheel and left wheels.

    Step 2Produce a UML class diagram.
    Using UML, describe the objects and classes that will be associated with this new toy. Either hand draw or use an appropriate UML creation tool to generate a UML design document for your Robot class. Create a set of classes that can be used to control the robot.
    Step 3Develop your new class.
    Create a new NetBeans® project entitled, "Assignment_7_1" and develop your new class. Now, using the objects and classes that you have written, write a program for your robot that allows it to move in a large square. Allow your robot to run in a big two dimensional array and every time the robot encounters a square in your array, turn that square black.
    Step 4Develop a framework application.
    Develop a framework application to implement your new class. Your framework application should test and demonstrate all the functionality of your class. Take a screen shot your NetBeans® IDE showing the output from your Java program.

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: New to Java and this forum need some help.

    Ok, console will be a lot easier than doing GUI.
    If you don't understand my response, don't ignore it, ask a question.

  7. #7
    blackhawk01 is offline Member
    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0

    Default Re: New to Java and this forum need some help.

    I posted the question to the instructor but I have not got a response to any other question since I started the course and expect no less this time. Any help would be appreciated.

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: New to Java and this forum need some help.

    Quote Originally Posted by blackhawk01 View Post
    New to Java and this forum need some help.
    Please go through the Forum Rules, particularly the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    blackhawk01 is offline Member
    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0

    Default Re: New to Java and this forum need some help.

    Ok. I won't do that anymore
    DarrylBurke likes this.

  10. #10
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,423
    Blog Entries
    7
    Rep Power
    27

    Default Re: New to Java and this forum need some help.

    Quote Originally Posted by blackhawk01 View Post
    I have requested help from all my classmates and we are all in the same boat. This instructor sucks.
    Of course; it's the instructor's fault again; maybe, just maybe, she wants you to be able to do your work on your own, without being taken by the hand to be guided to the solution ...

    Jos
    DarrylBurke likes this.
    Build a wall around Donald Trump; I'll pay for it.

  11. #11
    blackhawk01 is offline Member
    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0

    Default Re: New to Java and this forum need some help.

    I would agree with you if I was not in my fourth week of class in Java 1 and already on chapter 9 of the book. The only correspondence the instructor has given was the welcome at the start of the class and does not respond to her emails. So yes I want to be able to do this on my own and I would if I just knew where to start.

  12. #12
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: New to Java and this forum need some help.

    Start by making a list of the features the program needs to have.
    Using that list, make a list of the steps the program must take to implement each of the features in the first list.
    If you have specific java programming questions about how to write the code for a step, post the details on what you want the code to do and the problems you are having.
    If you don't understand my response, don't ignore it, ask a question.

  13. #13
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,423
    Blog Entries
    7
    Rep Power
    27

    Default Re: New to Java and this forum need some help.

    Apply Occam's razor: you don't care about how many wheels the thing has, nor about sensors; your robot is able to move in a two dimensional array in the directions north, east, south or west; neither can it 'fall off' the two dimensional array. Try to model that part first and go on from there.

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  14. #14
    blackhawk01 is offline Member
    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0

    Default Re: New to Java and this forum need some help.

    Thanks, trying to get it done. I have the list of objects and behaviors and I am trying to get that in to code. Capsulated the variables and using the methods to call the variables. Still not sure how to do the 2 dimension array and have my robot go from square to square and turn each square black.

  15. #15
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,001
    Rep Power
    33

    Default Re: New to Java and this forum need some help.

    turn each square black
    If its not a GUI program, how will the code indicate a black square? If its an array of ints, chose an int value to represent that the square's color.
    For example:
    Java Code:
      final int BLACK_SQUARE = 123; //  use to set the value of a square to Black
         ....
      matrix[row][col] = BLACK_SQUARE;  // set this square black
    If you don't understand my response, don't ignore it, ask a question.

  16. #16
    blackhawk01 is offline Member
    Join Date
    Mar 2015
    Posts
    9
    Rep Power
    0

    Default Re: New to Java and this forum need some help.

    Thanks I will give that a try.

Similar Threads

  1. hi new to forum as well as java
    By anoop_mig25 in forum Introductions
    Replies: 2
    Last Post: 04-02-2011, 11:00 AM
  2. Hello Java Forum
    By maitvn in forum Introductions
    Replies: 6
    Last Post: 08-19-2008, 07:03 PM
  3. Move to forum 'New To Java'
    By jvasilj1 in forum New To Java
    Replies: 2
    Last Post: 02-02-2008, 08:22 AM
  4. New To Java Forum
    By nani5swamy in forum Introductions
    Replies: 3
    Last Post: 01-04-2008, 03: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
  •