Results 1 to 7 of 7
  1. #1
    damsca is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Unhappy Very new to Java, need help :)

    Hi,
    I just started my computer study and I get java as the language of my programming class.
    I have no experience whatsoever with programming and I got this homework of making a java program concerning rectangle and determining whether a point falls within the rectangle.
    Would someone please point me to the right direction on where to start?
    I have a couple of Java books with me but I still get confused.
    The task:
    - 6 integers as input, representing 3 points.
    2 points of the rectangle and the 3rd point is the point I have to determine whether it is inside/on the rect or outside

    Someone told me I have to use arrays???

    I'm sorry if my question sounds like I just wanted a quick solution to my homework but I really really don't know where to start.
    No programming experience at all.
    Please don't condemn me or make mean remarks...

    Thank you.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,873
    Rep Power
    25

    Default Re: Very new to Java, need help :)

    where to start
    Make a list of the things the program needs to do in the order they need to be done.
    Write code for the first item in the list, compile and test it. When it works, move to the next item.

    When you have problems or specific questions, post them.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Very new to Java, need 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.

  4. #4
    damsca is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: Very new to Java, need help :)

    About the title of the post?
    Sorry about that.
    As I am really lost, I'm not even sure what kind of specific question to ask.
    I have got no programming experience at all, so not just in java.
    Anyway, sorry again if my posting is not according to the forum rules.

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,873
    Rep Power
    25

    Default Re: Very new to Java, need help :)

    Look at your class notes. They must explain something useful for the assignment. Don't try to do it all at once. Start with the simplest first steps: Define a class and a main() method. Type the code in, compile it and execute it.

    How would you solve this problem using paper and pencil? Do it in very short simple steps.
    1) ask user for the first point
    2) read in the x,y values
    3) do the above again for the second and third points.
    4) draw the points on the paper
    5) look at the paper, how do you determine if the third point is in the rectangle created by the first two points?
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    damsca is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: Very new to Java, need help :)

    Hi,
    That's exactly the problem. Most of the other students have had programming classes in their high school so they don't really feel the need of teaching us java from the beginning.
    So I have no class notes. Besides, this is the first week of school and we have had only 2 meetings concerning programming.
    I have tried to write something and I got the Static Error message (this class does not have a static void main method accepting string[].
    According to the instruction I got, the input has to be 6 digit numbers so I can not ask the user to put 2 coordinates 2 times.
    It has to be at once and the user has to enter 6 digit.
    Can I start my program with this?

    class Square
    {
    public static void main (int a, int b, int c, int d, int e, int f)
    {
    System.out.print("Type in a 6-digit number:"a+b+c+d+e+f);

    if (a>c);
    if (b>d);{
    System.out.println("error");
    .......


    Thanks.

  7. #7
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,873
    Rep Power
    25

    Default Re: Very new to Java, need help :)

    Look at any other program on the forum for the correct syntax for the main() method.

    You have not listed the steps the program is to take to solve the problem. You have gone ahead and tried to write some code before you have defined how the program is supposed to work. Make the list of steps first, THEN write the code.
    For example you have written code that will get the numbers from the command line when the program is started
    instead of asking the user to enter the numbers after the program has started. Which way is the program supposed to work?
    If you don't understand my response, don't ignore it, ask a question.

Posting Permissions

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