Question: to be completed in Java. the second picture is the class which needs to be modified for the assignment. answer numbers 1-3. implement the program
to be completed in Java.

the second picture is the class which needs to be modified for the assignment.


answer numbers 1-3. implement the program using java.
Implement the Java class depicted below, using your own code. You may not use the API's ArrayList class or any other API collection save arrays. Be sure to follow the specs exactly. Please keep with the spirit of the assignment or risk a significant penalty. You will revise the Weiss ArrayList class with the following modifications (Note that from this point onward substitute "Whatever" with your class name - details below): 1) The list must be sorted in ascending order at all times, with no null references in the middle of the data. The list must have this order maintained at the end of every public method call, so some existing methods will need to be modified 2) Modify the add () (and any other methods as you see fit) method of the class so that each new item is inserted in sorted (ascending) order 3) Overload add() with signature specified below. This method inserts the item at the specified index, adjusting incumbent items as needed. Note that if the index parameter is not the proper one for that item based on ordering the method should insert the item at the proper index that places it in order, not the requested one. public void add (int index, AnyType element) 4) Modify the set () method so that it replaces and returns the item at the specified 5) Adjust the constructor that takes a Collection parameter so that it creates the 6) Add another constructor that takes in a lone integer parameter. The Whatever is index. Observe and adjust for any issues due to the requested index and order as specified for the overloaded add () method in 3). Whatever with the same size as the Collection passed to it. The constructor still initializes the Whatever with the contents of the Collection parameter he Whatever initially created to this size rather than the default size 7) Add an instance method named getMode () that returns the most-occurring value in the list. The method's return type is Result, a generic interface that has two methods: AnyType mode (), which returns the most-occurring item in the list, and int count (), which returns how many times that item occurs. Tiebreak on first- occurring item of the highest frequency. The code for the Result interface will be provided to you to incorporate into your package. Do not send this interface file with your code. Note that the object you return needs to be a very simple container with the values necessary to support the interface methods. It does not include any computation logic- all work should be done by your list class. neric static method that takes in a (your) Whatever and performs a two parameters: a Whatever, and binary search on it. The method takes exactly the item to search for. The type of the second parameter needs to reflect what could possibly be in the list where the item resides, or -1 if not found. The method header will look in the Whatever instance. This method returns an int that is the index similar (same name but you need to revise it to make it use generics) to: public static int binSearch (Whatever list, AnyType item) 1 package weiss.util; 52 53 3 public class ArrayListcAnyTypes extends AbstractCollection implements List
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
