• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Singly linked list not printing correctly.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys. I need help with a project I am working on. Its a program that creates a singly linked list that stores names and high scores and prints them. For some reason it is printing an entry extra times. Also my remove function is not working properly can someone help me out? Thank you in advance. Here are my four classes. I just need a nudge in the right direction.



LinkedList class

Scoreboard class:


ScoreboardTest class:

Output:
The Original High Scores
[, (Flanders, 681), (Burns, 152), (Smithers, 150), (Apoo, 648), (Maggie, 980), (Lisa, 506), (Homer, 12), (Bart, 875), (Otto, 438), (Krusty, 324), (Krusty, 324), (Krusty, 324)]
Scores after adding Moe
[, (Flanders, 681), (Tyler, 0), (Burns, 152), (Smithers, 150), (Apoo, 648), (Maggie, 980), (Lisa, 506), (Homer, 12), (Bart, 875), (Otto, 438), (Krusty, 324), (Krusty, 324), (Krusty, 324)]
Scores after removing Apoo
[, (Flanders, 681), (Tyler, 0), (Burns, 152), (Smithers, 150), (Apoo, 648), (Maggie, 980), (Lisa, 506), (Homer, 12), (Bart, 875), (Otto, 438), (Krusty, 324), (Krusty, 324), (Krusty, 324)]
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also posted at: http://www.javaprogrammingforums.com/whats-wrong-my-code/39908-help-singly-linked-list.html
 
eat bricks! HA! And here's another one! And a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic