Question: DATA STRUCTURES- MUST USE JAVA PROGRAMMING Develop an application that interacts with the user to accept live user input into an Integer linked list. When
DATA STRUCTURES- MUST USE JAVA PROGRAMMING




Develop an application that interacts with the user to accept live user input into an Integer linked list. When adding for the first time, the input becomes the only element of the linked list. After that, whenever the user is prompted to give a new input, your application must compare the new input with the other elements of the linked list and sort them in an order. The order can be ascending or descending. In addition, the sorted linked list should not have any duplicates too. When the user terminates the program, your application returns the length of the linked list, and the total count of all elements inside the linked list. Figure 3 shows an illustration of the processes involved. Input: 5 Display linked list: [5] Input: 4 Display linked list: [4]+[5] Input: 12 Display linked list: [4]>[5]>[12] Input: 4 Display linked list: found a duplicate, item not added to linked list Input: 2 Display linked list: [2]>[4]>[5]>[12] Input: 10 Display linked list: [2]>[4]>[5]>[10]>[12] Input: 10 Your linked list length is: 5 Your total count is: 33 Rajah 3: Illustrasi contoh paparan aplikasi Figure 3: An example illustration for the application output In writing this program application, you are encouraged to give attention to a neat coding arrangement. Consider some visualization to display the processes involved in this question for a full mark. Table 3 is attached as a reference to the commonly used method names and their specifications for the linked list. You are encouraged to implement other methods that are relevant to your application. Table 3: List of methods and their specifications for a linked list Pembina/Nama Metod Spesifikasi Constructor/Method name Specification i) Constructor for the Konstruktor lalai untuk kelas senarai berpaut linked list class Default constructor for the linked list class ii) Constructor for the node Konstruktor lalai untuk kelas nod class Default constructor for the node class iii) isEmpty Memulangkan sama ada senarai berpaut tersebut adalah kosong atau tidak Return whether or not the linked list is empty iv) add Menambah elemen ke dalam senarai berpaut Add element to the linked list v) addBefore Menambah elemen baru sebelum elemen sedia ada di dalam senarai berpaut Add new element before existing element in the linked list vi) remove Membuang elemen tertentu dari senarai berpaut Remove a particular element from the linked list vii) display Memaparkan elemen-elemen di dalam senarai berpaut Display all elements in the linked list viii) totalCount() Mengira jumlah yang dikumpul di dalam senarai berpaut Count the total collected in the linked list No marks will be given for any implementation using the existing Linked List class or any other Collection classes available from the Java API Library
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
