Question: Use Java Please The second class, StringArraystatistics, needs to store an array of Strings as an instance variable. You should create three constructors for this

Use Java Please  Use Java Please The second class, StringArraystatistics, needs to store an
array of Strings as an instance variable. You should create three constructors

The second class, StringArraystatistics, needs to store an array of Strings as an instance variable. You should create three constructors for this class: a default constructor that creates an array of 5 empty String values, a parameter constructor that accepts an array of Strings, and a parameter constructor that accepts an integer value, representing the length of the array, and creates an array based on that number. You will need to complete the following methods in the SringArrayStatistics class: - addAt Index - accepts two parameters: a String value to be added to the array and an index of where in that array should be located. The method will add the String value at that index (replacing what was already there not shifting!), and return nothing. - tostring - returns a String with the array contents in the form \{"string 1", "string 2", "string 3"\}. Note that there are double quotes around each string, and that there is a comma then a single space between each pair of elements, but there are no spaces/commas at the start/end, only curly braces. averageLength - returns the arithmetic mean average of the length of the Strings in the array as a double (note: as before some values returned may have roundoff errors, but ignore these). search - has a single String parameter and returns an int which is equal to the index of the first appearance of the parameter String, or 1 if it does not appear in the array. sortstatus - returns an int which is equal to - 1 if the array is sorted in alphabetical order - 1 if it is sorted in reverse alphabetical order - 0 if it is not sorted in either of these ways - Note that a String may appear twice in a row in an array which is sorted in alphabetical or reversealphabetical order. If every String in the array is the same, then it is counted as being in alphabetical order

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!