• Post Reply Bookmark Topic Watch Topic
  • New Topic

Array output  RSS feed

 
Collin Sampson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why is for loop in the display method only printing the first argument (oneArray) correctly? It is only repeating the other arguments...

 
Collin Sampson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, I see.

It should've been: Array Output (No rush though) ;D

 
Paul Clapham
Sheriff
Posts: 22829
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. So what is your question? It looks like it's something about what the programming is outputting. Could you explain that a bit more?
 
Collin Sampson
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure Paul.

The Program is Outputting:

 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Change your program to something more manageable, like 3 or 4 months.

2. Step through it manually, making note of what you think the values of relevant variables will be at various points, which code paths will be followed for if statements, how many times a loop will execute and what will happen/change each time through, etc.

3. Add a bunch of print statements so that running the program will print out what's actually happening with regards to the above. (Or use a debugger if you're comfortable with one.)

4. Compare your expected output with the actual output. Where they differ, you've narrowed down the source of a problem.

5. Try to figure out why that difference arose. Validate or disprove your own assumptions.

6. If you can't figure it out, or if you don't see a difference, you need to look somewhere else. Go back to step 2, and reevaluate what "relevant" means.

It may seem like a long and tedious process, but in the vast majority of cases, it's faster and more effective than just guessing. Skilled professionals do it this way too. The really skilled ones start with something manageable before they go for the full-blown thing, and write code to test their real code before they write their real code.

And of course, if you get to where you really can't make any more progress, post again, showing what you've done, what output you got, and what output you expected. (I didn't see that last one in your most recent post.)
 
dennis deems
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still don't understand what your question is. You desire output that is different from what you are getting, but you haven't explained what it is you want, and you haven't really shown the output you do get. How about starting with a clear explanation of that the program is meant to do?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!