Question
// ******************************************************** // Array-based implementation of the ADT Sorted List. // ********************************************************* /** * class SortredListArrayBased * * A class gets inherited from ListArrayBased *
// ******************************************************** // Array-based implementation of the ADT Sorted List. // ********************************************************* /** * class SortredListArrayBased * * A class gets inherited from ListArrayBased * */ public class SortedListArrayBased extends ListArrayBased { public SortedListArrayBased() // creates an empty list { // TO BE IMPLEMENTED BY YOU }// end default constructor public void add(Object item) throws ListException // Inserts item into its proper position in a sorted list // Throws an exception if the item connot be placed on the list { try { // TO BE IMPLEMENTED BY YOU } catch(Exception e) { throw new ListException("Add to List failed: " + e.toString()); } } public void remove(Object item) throws ListException // Removes the item from a sorted list. // Throws an exception if the item is not found. { try { // TO BE IMPLEMENTED BY YOU } catch(Exception e) { throw new ListException("Remove " + item.toString() + " from List failed: " + e.toString()); } } public int locateIndexToAdd(Object item) { // TO BE IMPLEMENTED BY YOU } public int locateIndexToRemove(Object item) // Returns the position where the item belongs or exists in a sorted list; // Otherwise, it returns -1. { // TO BE IMPLEMENTED BY YOU } } // end SortedListArrayBased
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started