• Post Reply Bookmark Topic Watch Topic
  • New Topic

Issues with output in my program  RSS feed

 
Ryan Gordon
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to display the information of 15 people from my array but when I compile the program I get just the last element in the array.





I'm trying to get this displayed for all 15 people.
Any help is appreciated, thank you.
 
Carey Brown
Saloon Keeper
Posts: 3317
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Line 87 you have report = which replaces whatever was previously in report.
 
Carey Brown
Saloon Keeper
Posts: 3317
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Style suggestions:
  • Never use two or more blank lines together.
  • Don't double space lines with blank lines.
  • Be consistent with your placement of braces.
  • Be consistent with your indentation.

  • When you put in the effort to keep your code clean you'll find that other people are more willing to put in effort to help you.
     
    Ryan Gordon
    Ranch Hand
    Posts: 55
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I will keep my code neater from now on, thank you for the heads up. I don't know what to do about the report = . If I don't have it I will get errors and be unable to print. I added it because without it The results come out in gibberish letters instead of the proper result. I'm not sure what to do in this situation.
     
    Carey Brown
    Saloon Keeper
    Posts: 3317
    46
    Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The problem with report = is that every time through the loop report will be over written, hence, you only see the last entry. If you want to append to report you can use report +=.
     
    Ryan Gordon
    Ranch Hand
    Posts: 55
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you, that worked perfectly I really am grateful.
     
    Carey Brown
    Saloon Keeper
    Posts: 3317
    46
    Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You're welcome. Glad I could help.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!