Hello all,
I'm trying to print the contents of a queue using nodes but I get duplicates for some reason and I don't understand why. Here is my code:
The unbounded interface just overrides a queue interface where the enqueue, dequeue, size, and toString methods are. The console prints the last item added to the queue. For example, if I add Mary with ID 10, Jon with ID 20, and Adrian with ID 30, the program will print:
Student name: Adrian and the ID is: 30
Student name: Adrian and the ID is: 30
Student name: Adrian and the ID is: 30
Please help me by pointing where the error/bug is, tell me in a conceptual way so I see what's wrong and to code it.
I'm trying to print the contents of a queue using nodes but I get duplicates for some reason and I don't understand why. Here is my code:
The unbounded interface just overrides a queue interface where the enqueue, dequeue, size, and toString methods are. The console prints the last item added to the queue. For example, if I add Mary with ID 10, Jon with ID 20, and Adrian with ID 30, the program will print:
Student name: Adrian and the ID is: 30
Student name: Adrian and the ID is: 30
Student name: Adrian and the ID is: 30
Please help me by pointing where the error/bug is, tell me in a conceptual way so I see what's wrong and to code it.