Question: Hi guys I just need codes for some java functions in a singly linked list 1) the insert method to do the following: Accept a

Hi guys I just need codes for some java functions in a singly linked list

1) the insert method to do the following: Accept a location, default null If location is null, add node at the tail Otherwise iterate over the list and insert the node in the location supplied. See presentation on linked lists for theory on how to do this. Make sure to include error checking if the user attempts to add in a location outside the scope of the list. If they do, display the error and return to main.

2) a Remove method to do the following: Accept a location, default null If location is null, remove node at the head of the list Otherwise iterate over the list and remove the node in the location supplied. See presentation on linked lists for theory on how to do this. Make sure to include error checking if the user attempts to remove from a location outside the scope of the list. If they do, display the error and return to main.

3) a new method called DisplayUserMenu: Print menu for the user: 1 - Print list 2 - Add to tail of list 3 - Add at location i 4 - Remove from tail of list 5 - Remove at location i 6 - Cancel and exit the program Read in an integer from the user Make sure to include error checking. This is required any time the user gives you input. Pass choice back to main

also

1. Add a loop for user input between the list creation and the printlist method call. 2. Perform the operation the user requested. Pseudocode: While user does not want to cancel call the menu method and receive the user input. 3. Perform the operation the user requested above and then loop back to call the menu method again. 4. If user selects either 3 or 5, you will have to ask the user what location they want to add/remove. 5. Make sure to include error checking. This is required any time the user gives you input

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!