Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22
  1. #21
    xdrazkalnytex is offline Member
    Join Date
    Mar 2012
    Posts
    34
    Rep Power
    0

    Default Re: Already finished 1-5. Wondering if Someone can help with Steps 6-9. Please & Than

    ok so that's the start of the loop. Would this loop here give me the largest value in the values array?
    for(int i =0; i < values.length; i++);
    {
    int maxValue= values[maxIndex+1];
    }

  2. #22
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,318
    Rep Power
    25

    Default Re: Already finished 1-5. Wondering if Someone can help with Steps 6-9. Please & Than

    No, your loop does nothing useful.
    I don't know what the value of the maxIndex variable is. What value is in the array when you index the array using:(maxIndex+1)? why do you add one to maxIndex?

    It could be the max value in the array. For example say the max value in the array is the value at index 2, then if maxIndex was = 1 then values[maxIndex+1] would be the max value.
    But this has nothing to do with the problem of looking at all the elements in the array and finding the max value.
    You will need to use an if statement to compare the values.
    If you don't understand my response, don't ignore it, ask a question.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 4
    Last Post: 03-27-2012, 10:47 AM
  2. Replies: 1
    Last Post: 03-23-2012, 04:09 AM
  3. Replies: 2
    Last Post: 09-25-2011, 02:48 AM
  4. Wondering..~
    By ryozkidz in forum Java Applets
    Replies: 0
    Last Post: 01-20-2011, 10:09 PM
  5. Hi, i was wondering if someone could help me
    By deathnote202 in forum New To Java
    Replies: 4
    Last Post: 04-23-2010, 05:03 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
  •