Results 1 to 7 of 7
  1. #1
    shroomiin is offline Member
    Join Date
    Sep 2009
    Posts
    31
    Rep Power
    0

    Default beginner here...help please

    hello everyone. im new here and also a beginner to java. I have a college professor who does not explain anything and just expects us to know how. so i have a pretty simple question here.

    ok were just doing pseudocode right now not actual java. but im stuck on a concept. the question is...in pseudocode...

    Read some grades until a -999 is entered. find and display the lowest of these grades. This is what i have so far..

    Begin-
    Read grades
    While not equal to -999
    .....

    thats where i am stuck, not sure what to say after that haha. so please help a noob out over here! thanks

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Here's a trick: Say you're a scribe with nothing more than a pencil and a pad of paper, and someone is telling you numbers until they tell you -999, and given this information you must tell him at the end the lowest number.

    The key here is to think of the steps required to do something like this without a computer, with just the paper and pad as noted above. Try to describe the exact steps required, break the steps down into their most atomic sub-step, and from these steps the pseudocode (and eventually the code) will flow naturally. Well, how about giving it a go? Much luck!

    edit: oh, by the way, get used to having to learn because of or despite your teachers. You'll find that in college and in life, the ultimate responsibility for learning is not the teacher's but yours. You can do it but it may require more effort. Again, luck.
    Last edited by Fubarable; 09-15-2009 at 04:31 PM.

  3. #3
    shroomiin is offline Member
    Join Date
    Sep 2009
    Posts
    31
    Rep Power
    0

    Default

    i just dont understand how to use the while statements well enough. i dont know what to say because i dont know what to compare the lowest number to, you know what i mean?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  5. #5
    shroomiin is offline Member
    Join Date
    Sep 2009
    Posts
    31
    Rep Power
    0

    Default

    well i would take down all the numbers to be recorded...go through them and find the lowest number...

    but thanks in advance for the help/advice
    Last edited by shroomiin; 09-15-2009 at 09:20 PM.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Again, find the smallest sub steps here, the "atomic" steps. Myself, I would:
    ask the fellow for a number
    if it's not the sentinel number (-999), write it down.
    Ask for another number.
    if it's not the sentinel number (-999), and if it's lower then the current number, write it down.
    Ask for another number.
    if it's not the sentinel number (-999), and if it's lower then the current number, write it down.
    Ask for another number.
    if it's not the sentinel number (-999), and if it's lower then the current number, write it down.
    Ask for another number.
    if it's not the sentinel number (-999), and if it's lower then the current number, write it down.
    ... (see anything "looping" here?)
    until the sentinel number has been reached, then return the last number I've written down.

    Next I'd take these steps and try to create a loop that would simplify this.

  7. #7
    shroomiin is offline Member
    Join Date
    Sep 2009
    Posts
    31
    Rep Power
    0

    Default

    wow thanks. that really helped me out, i couldnt see it like that for some reason...heres what i came up with..

    Begin-
    Smallest number=j
    Prompt user for grade
    While grade is not equal to -999
    Grade =j
    Prompt user for grade2
    If grade2 is<j
    Then grade2=j
    Prompt user for grade3
    If grade3 is<j
    Then grade3=j
    End while
    Display J
    -end.



    thats probably still wrong but not as bad haha

Similar Threads

  1. How And Where To Start For A Beginner
    By DaneX in forum New To Java
    Replies: 3
    Last Post: 08-20-2009, 04:24 PM
  2. Beginner needs help!
    By Polyy in forum New To Java
    Replies: 1
    Last Post: 11-27-2008, 05:12 AM
  3. Java Beginner needs help!!
    By Polyy in forum New To Java
    Replies: 4
    Last Post: 11-23-2008, 02:11 AM
  4. almost done...beginner needs help plz..
    By shongo in forum New To Java
    Replies: 15
    Last Post: 11-10-2008, 08:14 AM
  5. beginner needs help with OBD-II input
    By andrewos in forum New To Java
    Replies: 3
    Last Post: 07-30-2007, 09:46 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
  •