public class Square extends Shape{ double height; public…

Question public class Square extends Shape{ double height; public… Image transcription textCS 2003 Fundamentals of Algorithmsand Computer ApplicationsImplementing the SortedL… Show more… Show moreImage transcription text5 public class TestSortedList { 6 8 * Sample tests. 19 10 * / 11 privatestatic final PrintStream OUT = System. out; 12 130 public static voidmain (String args) { 14 // Main function to test SortedList… Show more… Show moreImage transcription textpublic interfaceSortedListInterface{ public abstract double getArea(); public int compareTo(Shape s){  double areaS = s.getArea();  double areaThis = getArea();  if (areaThis < areaS)   return -1;  else if (areaThis == areaS)   return 0;  else   return +1; }  public abstract String toString(); }//new classpublic class Rectangle extends Shape {double length;double height;public Rectangle(double l, double h){ length = l; height = h;}public double getArea(){ return length*height;}public String toString(){ return "Rectangle ("+length+"x"+height+")";}}//new classpublic class ListIndexOutOfBoundsException            extends IndexOutOfBoundsException { public ListIndexOutOfBoundsException(String s) {   super(s); }  // end constructor}  // end ListIndexOutOfBoundsException//new classpublic class ListException extends RuntimeException {   public ListException(String s) {     super(s);   }  // end constructor }  // end ListException //new classpublic class Disk extends Shape {double radius;public Disk(double r) { radius = r;} public double getArea(){  return Math.PI*radius*radius; }  public String toString(){  return "Disk ("+radius+")"; }}//new classpublic interface BasicListInterface {   /** Tests if this list has no elements.    * @return true if this list has no elements;    * false otherwise.    */   public boolean isEmpty();      /**    * Returns the number of elements in this list.    * @return the number of elements in this list.   */   public int size();      /** Removes all of the elements from this list.    */   public void removeAll();     /**    * Returns the element at the specified position in this list.    * @param index index of element to return.    * @return the element at the specified position in this list.    * @throws IndexOutOfBoundsException – if index is out of range    * (index < 1 || index > size()).    */   public E get(int index) throws ListIndexOutOfBoundsException;} // end BasicListInterface//new class, one that needs changedimport java.util.ArrayList;public class SortedList>   implements SortedListInterface{   private ArrayList list; }  // end class Note: Binary search is required in the solution Computer Science Engineering & Technology Java Programming CS 2003 Share QuestionEmailCopy link Comments (0)