In the lecture, we introduced a new linear data structure called Linked-list. A Linked-list allows us...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
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 the full answer
Related Book For
International Marketing And Export Management
ISBN: 9781292016924
8th Edition
Authors: Gerald Albaum , Alexander Josiassen , Edwin Duerr
Posted Date:
Students also viewed these programming questions
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
?Claim: A of adults would erase all of their personalinformation online if they could. A software firm survey of 511randomly selected adults showed that 36 ?% of them would erase allof their pe...
-
This week, we looked at several examples of early modernist art such as Cubism, Fauvism, futurism, and expressionism. Let's discuss the relationships between these aesthetic categories and the...
-
In a DS/BPSK system, the feedback shift register used to generate the PN sequence has length m = 19. The system is required to have an average probability of symbol error due to externally generated...
-
What are the fundamental differences between two-stroke and four-stroke engines?
-
Jasper Metals, Inc. just announced that it will pay its regular quarterly dividend of $3.50 per share. a. Does the stock price fall to reflect this payment on the announcement date, the record date,...
-
Calculate the tension in the following figure: T 30 30 250 N T2
-
Determine the theoretical and actual material required to produce the part, shown in figure. Raw stock is supplied in 0.875 in. diameter. A lathe cutoff tool width is 0 125 in. A 0.015 in. stock...
-
Besides their shape, how does a 2s orbital differ from a 2p orbital? O In a multi-electron atom, the 2p orbital is higher in energy than the 2s orbital 2p orbitals are larger than 2s orbitals A 2s...
-
Each module you will be asked to reflect on your learning. Reflection papers are worth 10% of your final grade. These reflections will consist of a brief (approximately 100- 150 words) one-paragraph...
-
What key similarities or differences do you see in the narrators or subject matter of Life of a Sensuous Woman and any of the previous East Asian readings?
-
Do you believe that the government should help homeowners who could lose their homes or go into foreclosure? Should the government help the financial institutions that provided the loans? What about...
-
What characteristics would you expect to see in a reader who should be at the emergent and beginning stages of reading?
-
Describe different types of approaches you can use when observing and gathering information about children's learning ?
-
Auditing in COVID times. Any changes or challenges during COVID times. You are expected to cover but not be limited to the following issues; Audit risk Audit procedures, interim and final Gathering...
-
Why can wastewater treatment requirements in Hawaii be less stringent than those in most locations on the U.S. mainland?
-
Explain the meaning of the following statement: Managing multiculturalism within the international marketing organization and within the markets it serves is what makes international marketing...
-
Go to a European companys website, an Asian/Pacific companys website, and a US or Canadian companys website and evaluate each in terms of its use for marketing communications about the companys...
-
In mid-2004 the president of Elis Cheesecake Company, Mr Marc Schulman, was reviewing the policies that had guided the international expansion of the firm. In the 1990s the company had recognized the...
-
Research Problem Access the FASB website: https://fasb.org. Locate information about updates to accounting standards in the most recent year listed. Choose one of the updates and write a short essay...
-
Select a publicly traded company or use a company assigned by your instructor. Using the firms most recent Form 10-K report (accessed through the SEC EDGAR database or from the companys website),...
-
What reports are required to be filed regularly with the SEC?
Study smarter with the SolutionInn App