subject

For this assignment, you will complete two separate classes which will be used to find statistics from arrays. The first class, NumStatsArray, needs to store an array of doubles as a member variable. This should be declared as private and final, so none of your methods will set this variable to point at a different array. The single constructor for this class has a parameter of a double array, and should set the member variable to point to this parameter array. You will need to complete the following methods in the NumStatsArray class (you may assume that the member variable array is not empty when writing these methods):
toString - returns a String with the array contents in the form {1.0, 4.0, 5.0}. Note 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.
average - returns the arithmetic mean average of the numbers in the array as a double. This is found by dividing the sum of the numbers by the amount of numbers in the array (note: some values returned may be slightly inaccurate due to roundoff errors, which you do not need to worry about for this assignment).
range - returns a double found by subtracting the smallest number in the array from the largest number in the array
sortStatus - returns an int which is equal to 1 if the array is sorted in increasing order, -1 if it is sorted in decreasing order or 0 if it is not sorted. The array is sorted in increasing order if every number is greater than or equal to the previous number. The array is sorted in decreasing order if every element is less than or equal to the previous number. If neither of these is true then the list is unsorted. If every element in the array is the same, then it is counted as being in increasing order.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
What is the process in which the software development team compiles information to determine the final product.
Answers: 3
question
Computers and Technology, 23.06.2019 23:30
Match the following errors with their definitions. a. #name b. #value c. #ref d. 1. when a formula produces output that is too lengthy to fit in the spreadsheet cell 2. when you enter an invalid cell reference in a formula 3. when you type text in cells that accept numeric data 4. when you type in a cell reference that doesn’t exist
Answers: 1
question
Computers and Technology, 24.06.2019 13:30
Which type of excel chart should be used to track students’ progress on test grades? line column bar pie
Answers: 2
question
Computers and Technology, 25.06.2019 03:30
Which task should happen during the planning stage of a project
Answers: 2
You know the right answer?
For this assignment, you will complete two separate classes which will be used to find statistics fr...
Questions
question
Mathematics, 30.04.2021 20:50
question
Mathematics, 30.04.2021 20:50
question
Mathematics, 30.04.2021 20:50
Questions on the website: 13722359