Modify the class linkedlist by adding to it the following


Answer the following questions and also justify your answers with suitable examples

Question 1: Modify the class LinkedList by adding to it the following methods. The appropriate error message should be generated if an invalid condition occurs.

Part a: toString():modify the display function to overload the toString function of theObject class.

Part b: int length(): create this function to determine the number of items in the list (accessor function).

Part c: void clear(): create this function to remove all of the items from the list. After this operation is completed, the length of the list is zero.

Part d: void insertEnd(int item): create this function to insert item at the end of the list.

Part e: void replace(int location, int item): create this function to replace the item in the list at the position specified by location. The item should be replaced with item.

Part f: int get(int location): create a function that returns the element at the positionlocation.

Question 2 :-. Using the class LinkedList, write a program to store 50 random numbers.

Suppose that each of these random numbers is an integer in the interval [10, 99]. There must be no duplicate numbers in the list.

You need to implement the link list using java programming concepts.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Modify the class linkedlist by adding to it the following
Reference No:- TGS0960576

Expected delivery within 24 Hours