Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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! image text in transcribed

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

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students explore these related Databases questions

Question

Define organisation chart

Answered: 3 weeks ago

Question

What are the advantages of planning ?

Answered: 3 weeks ago

Question

What Is acidity?

Answered: 3 weeks ago

Question

Explain the principles of delegation

Answered: 3 weeks ago