Question: this needs to be coded in JAVA please! 1. Create a new package named cst8132.sarray 2. CapacityoutOfBoundsException class, in the cst8132. sarray package, which extends

this needs to be coded in JAVA please! this needs to be coded in JAVA please! 1. Create a new

1. Create a new package named cst8132.sarray 2. CapacityoutOfBoundsException class, in the cst8132. sarray package, which extends RuntimeException. o CapacityOut0fBounds Exception () " Default constructor. Calls default super constructor. o Capacityout0fBoundsException (String s) Initial constructor. Passes the specified String message to the super class constructor " 3. StringArray class, in the cst8132.sarray package, with the following members o Import any Exception classes as required. Do not use any "catch-all import statements. o private int capacity // The current capacity of the array " How many Strings could my array contain? private int size //The current size of the array o How many String objects are populated in my Array? o private String[] stringArray // The current String array o StringArray() Default constructor, Constructs an empty StringArray with an initial capacity of 10 " o StringArray (int initialCapacity) throws IllegalArgumentException Initial constructor. Constructs an empty StringArray with the specified initial capacity " "Throws an IllegalArgumentException if the specified initial capacity is negative o StringArray(StringArray sa) throws NullPointerException "Copy constructor. Constructs a StringArray that is a deep copy of a given StringArray Do NOT use the Object.clone(), Arrays copyOf(), or System arrayCopy() methods. Throws a NullPointerException if the specified String is null. " o void add(String s) throws NullPointerException "Appends the specified string to the end of this StringArray. Increases capacity if needed. " Throws a NullPointerException if the specified String is null o void add(int index, String s) throws IndexOutOfBoundsException, NullPointerException Inserts the specified string at the specified position in this StringArray " Increases capacity if necessary. "Throws an IndexoutOfBoundsException if the index is out of range (index size()) "Throws a NullPointerException if the specified String is null "Returns the capacity of this StringArray " Removes all the Strings from this StringArray o int capacity() o void clear()

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 Databases Questions!