Hello! This is my first post I hope it goes well (actually second but there I posted in the wrong forum) so basically I want to make this code that I have insert people in ascending order. For example I input Berta Andy Cody, the outpust should be Andy Berta Cody. Here is the code, what changes do I need to implement so that the code posts in ascending order.
I have deleted the other post.
Why does the List implement PhoneBook? Is is a List at all? Please explain what that class is supposed to represent; we need to know what you want to do before you try to work out how to do it.
posted 1 week ago
Hey thank you! Well it implements the interface PhoneBook while the methods (insert,delete) are within that interface. This class PhoneBookList inserts deletes,looks up people.There is also a Person class that is wrapped up in this static final Node.Now what I want is this insert method is inserting people within the list.I want the people to be inserted in ascending order.Maybe it was a mistake posting the entire code but the change most likely has to be in the insert method.
Aiden Damantis wrote:So maybe removing one of those lines?
Changing your code at random to see what happens is one way to write programs. Just not a very good way. What you need to do now is to decide where in the code you're ready to move to the next node, and put that code there and there only.