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 doubly-linked, self-sorting 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 max_year = maxAceYear(data);
System.out.println(max_year);
to
DoublyLinkedSortedList link = data.getFirst();
HurricaneRowData dat = link.getValue();
int max_year = dat.getYear();
System.out.println("Year of max ace: "+max_year);
System.out.println("All data in order of Ace:");
System.out.println(data);
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 2: 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 contains(HurricaneRowData value);
/* Pre: This linked list contains the given value.
* Post: Returns the LinkedList element whose value
* matches the given value. */
public DoublyLinkedSortedList getByValue(HurricaneRowData value);
public DoublyLinkedSortedList getNext();
CODE:
//Return true if previous is not null
public boolean hasPrevious();
//Set previous to be the given DoublyLinkedSortedList
public void setPrevious(DoublyLinkedSortedList 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 remove(HurricaneRowData toRemove);
//Insert a new DoublyLinkedSortedList element that has the given newValue in order in the list.
public void insert(HurricaneRowData newValue);
//Return the entire list as a multi-line String
public String toString();
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!