Results 1 to 11 of 11

Thread: Stuck on step 5

  1. #1
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Stuck on step 5

    asdfasdfasdf
    Last edited by scd250; 11-07-2011 at 09:18 AM.

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Stuck on step 5

    Java Code:
    System.out.println(String word);
    What is wrong with the above line of code? What similar problem do you have in your code? Fix the first error and the second will probably disappear. For the third error it says it cannot find the variable 'i'. Where have you declared it?

  3. #3
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: Stuck on step 5

    I figured out the first one but I seriously can't see what you mean with the second, and I feel stupid. >.>

  4. #4
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Stuck on step 5

    Java Code:
    public void drawHor()   {
        // step 8:
        // draw horizontal bar graph (one line per roll value)
        for(int d = 1; d < values.length; d++)
            System.out.print("Count " + d + ":" + "\t" + values[i]);
        System.out.println("*");
    }
    In the first print statement you are using the variable 'i' to access an element of the values array. Where have you declared the 'i' variable?

  5. #5
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: Stuck on step 5

    I fixed that one already. The other two (step 5) is where I am stuck. That error was from me not paying attention. I honestly don't know how to fix the other two.

  6. #6
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Stuck on step 5

    I'm confused. You keep saying you have fixed things. What are your current errors?

  7. #7
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: Stuck on step 5

    asfasdfasdfasdf
    Last edited by scd250; 11-07-2011 at 09:18 AM.

  8. #8
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,800
    Rep Power
    7

    Default Re: Stuck on step 5

    Did you read the error messages? You are making a static call when the method is not static. What does that mean? Imagine you have a Person class. Each Person has a name. There are billions of Person objects in the world. If you say "print Person.name" which name should be printed? Your error relates specifically to this line:
    Java Code:
    Histogram.drawHor();
    Surely you can work it out yourself.

    As for the warnings you can either fix them or ignore them. If you code only has warnings and no errors, it will still compile and run. Ideally you would fix them in the long run but it is upto you.

  9. #9
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: Stuck on step 5

    asdfasdfsadfasdf
    Last edited by scd250; 11-07-2011 at 09:18 AM.

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

    Default Re: Stuck on step 5

    Those methods don't take any parameter; you are trying to pass an array of ints as a parameter; the compiler doesn't like that.

    kidn regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  11. #11
    scd250 is offline Member
    Join Date
    Oct 2011
    Posts
    34
    Rep Power
    0

    Default Re: Stuck on step 5

    Thanks guys :) I got the program 90% working, it was just irritating me that I couldn't figure it out. I had a friend from home help me. :)

Similar Threads

  1. Replies: 1
    Last Post: 08-18-2011, 08:47 PM
  2. Step-by-Step Billing system in Web Services
    By oneofthelions in forum Web Frameworks
    Replies: 2
    Last Post: 12-18-2009, 11:28 AM
  3. EJB3 Message driven beans step-by-step guide
    By nix123456 in forum Enterprise JavaBeans (EJB)
    Replies: 3
    Last Post: 09-28-2009, 02:29 PM
  4. Step-by-Step Tutorial: Achieve RAD with Seam+Eclipse+Tomcat
    By Techieexchange in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 11-13-2007, 08:13 PM
  5. Step-by-Step 0.95
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-14-2007, 09:17 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
  •