Question: using the instrctions modify the code attached please Instructions: Your task is to create a doubly - linked, self - sorting list that can be
using the instrctions modify the code attached please Instructions:
Your task is to create a doublylinked, selfsorting list that can be used in place of the ArrayList used in the Hurricane assignment.
If implemented correctly, minimal changes to Main.java will be needed to your Hurricane assignment code. For my solution, in Main.java the only changes I made were:
ArrayList data new ArrayList ;
to
DoublyLinkedSortedList data new DoublyLinkedSortedList;
and then I changed
int maxyear maxAceYeardata;
System.out.printlnmaxyear;
to
DoublyLinkedSortedList link data.getFirst;
HurricaneRowData dat link.getValue;
int maxyear dat.getYear;
System.out.printlnYear of max ace: maxyear;
System.out.printlnAll data in order of Ace:";
System.out.printlndata;
Nothing else was changed in Main.java.
An interface is provided to guide your design of DoublyLinkedSortedList. Your DoublyLinkedSortedList.java class must implement the interface. You can add more methods if you wish.
IMPORTANT: The data in the linked list MUST remain sorted at all times. In other words, as the data is added to the list, it must be automatically inserted in sorted order. You will not get full credit for sorting after all the data has been inserted.
IMPORTANT : Turn in all of your hurricane code including the adjusted Main.java along with the new code. You should turn in:
Main.java
HurricaneRowData.java
DoublyLinkedSortedList.java
Although the following is optional, you might consider adding the following methods to DoublyLinkedSortedList.java:
Post: Returns true if this linked list
contains the given value.
public boolean containsHurricaneRowData value;
Pre: This linked list contains the given value.
Post: Returns the LinkedList element whose value
matches the given value.
public DoublyLinkedSortedList getByValueHurricaneRowData value;
public DoublyLinkedSortedList getNext;
CODE:
Return true if previous is not null
public boolean hasPrevious;
Set previous to be the given DoublyLinkedSortedList
public void setPreviousDoublyLinkedSortedList previous;
Return a reference to the previous DoublyLinkedSortedList
public DoublyLinkedSortedList getPrevious;
Return a reference to the first DoublyLinkedSortedList element in the list
public DoublyLinkedSortedList getFirst;
Return a reference to the last DoublyLinkedSortedList element in the list
public DoublyLinkedSortedList getLast;
Remove the DoublyLinkedSortedList element that has toRemove as its value
public DoublyLinkedSortedList removeHurricaneRowData toRemove;
Insert a new DoublyLinkedSortedList element that has the given newValue in order in the list.
public void insertHurricaneRowData newValue;
Return the entire list as a multiline String
public String toString;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
