Question: In the lecture, we introduced a new linear data structure called Linked-list. A Linked-list allows us to store a collection of objects of the

In the lecture, we introduced a new linear data structure called Linked-list.A Linked-list allows us to store a collection of objects of thesame data type so that the ordering of those objects is determinedby references stored within each object. That is to say, each object

In the lecture, we introduced a new linear data structure called Linked-list. A Linked-list allows us to store a collection of objects of the same data type so that the ordering of those objects is determined by references stored within each object. That is to say, each object in the Linked- List stores information about the location of its successor object. In this problem set, you will implement a Linked-List data structure to store different object types. Moreover, you will practice using generic classes, that would allow you to build a Linked-list data structure whose type of objects it can store is defined at instantiation time. Learning Activity 1: Watch the video lectures on Linked-List and particular the coding sessions "Linked Lists Java Implementation" and "Linked List using Genetic Classes". The session "Linked Lists Java Implementation" showcases step-by-step how to implement and use a LinkedList to store a specific object type (namely Tweet Objects). The session Linked List using Genetic Classes" introduces the concept of generic classes and showcases how to implement and use a linked-list data structure using genetic classes. Task 1: Reproduce the object-specific Linked-List functionality. In this task, you are asked to reproduce the functionality presented in Linked Lists Java Implementation" by creating and using an object-specific LinkedList (i.e. without using genetic classes). In particular, you need to implement the following classes: Create a new class called User that stores information about a User. Specifically, the "User" class should maintain three public attributes, namely: userId, a userName, and user Age. In addition, the User class should implement a constructor method that takes as input values for all three attributes and initializes them. Finally, the User class should override the toString() method so it displays the UserId as its output. Create a UserNode class. This class should implement a node functionality to be used in a LinkedList. The class should mirror the functionality of the "TweetNode" class introduced in Linked Lists Java Implementation". Create a UserLinkedList class. This class should implement a LinkedList functionality to store and manipulate objects of type UserNode. The class should mirror the functionality of the "TweetLinkedList" class introduced in "Linked Lists Java Implementation" session. Specifically, the UserLinkedList class should implement the following methods: public void addLast(User a) public void addFirst(User a) public void addAt(User a, int index) Task 2: Reproduce the Generic Linked-List functionality. In this task, you are asked to reproduce the functionality presented in "Linked Lists Java Implementation" by creating and using an generic LinkedList (i.e. using genetic classes). In particular, you need to implement the following classes: Create a Node class. This class should be a generic class that implement a node functionality to be used in a genetic LinkedList. The class should mirror the functionality of the Node class introduced in "Linked List using Genetic Classes". Create a LinkedList class. This class should be a generic class implement a LinkedList functionality to store and manipulate any type of input object. The class should mirror the functionality of the "LinkedList" class introduced in "Linked List using Genetic Classes" session. Specifically, the LinkedList class should implement the same methods as the UserLinkedList but using generic types. Task 3: Demonstrate the correctness of your Linked-List implementation Create a Main.java class to demonstrate the correct implementation and use of the UserLinkedList and LinkedList classes. As part of the main method of the Main class implement the following use-case: Demonstrate the correctness of UserLinkedList class Create a new instance of the UserLinkedList class in a variable called mylist. Create four instances of User objects with their userid set to 100,200, 300, and 400 respectively (choose values for each user's name and age) Add each of the four instances to the mylist LinkedList in order, using the addFirst method. Print the content of the mylist by invoking the printList() method. Create a fifth instance of a User Object with its userid set to the value 500. Add this instance to the mylist LinkedList at index 3, using the addAt method. Print the content of the mylist by invoking the printList() method. Remove the object from the mylist LinkedList from index 3 using the remove method. Print the content of the mylist by invoking the printList() method. Demonstrate the correctness of LinkedList class Create a new instance of the LinkedList class in a variable called mylist. Create four additional instances of User objects with their userid set to 1000,2000, 3000, and 4000 respectively (choose values for each user's name and age) Add each of the four instances to the mylist Genertic LinkedList in order, using the addFirst method. Print the content of the mylistGenertic by invoking the printList() method. Create a fifth instance of a User Object with its userid set to the value 5000. Add this instance to the mylistGenertic LinkedList at index 3, using the addAt method. Print the content of the mylistGenertic t by invoking the printList() method. Remove the object from the mylistGenertic LinkedList from index 3 using the remove method. Print the content of the mylistGenertic by invoking the printList() method. O O O 00 Program Requirement Your implementation for the above program should comply with the following requirements and specifications: Your program should implement all the specification outlined above. Your code implementation should be efficient; unnecessary computations or unnecessary use of memory will be penalized. Do not use any helper methods/functions other than those provided. Your code must be well organized, code must be indented. You must use the data file provided as input to your program. Source code files must be submitted (not the compiled files) You must use the template code provided (if provided). Your program must compile and run without errors and generate the expected output.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Below is a basic implementation in Java for the described problemThis code implements a generic LinkedList in Java allowing it to store and manipulate ... View full answer

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 Programming Questions!