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 10:40
When running anti-virus software , what could be a reason where recipitent is not guaranteed that data being streamed will not get interrupted?
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Annie is creating a corporate report for a company’s annual meeting. in the report, she wants to add the signature of various department heads. which device can annie use to capture signatures to include in the report? a. printer b. monitor c. e-reader d. digitizing tablet
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
1. which of these is not true about torsion bars? a. they can be used to adjust ride height b. they can be adjusted anytime since they don't affect alignment angles c. they attach between the frame and the lower control arm d. they twist to produce a spring effect
Answers: 1
question
Computers and Technology, 25.06.2019 05:50
Acolor class has three public, integer-returning accessor methods: getred, getgreen, and getblue, and three protected, void-returning mutator methods: setred, setgreen, setblue, each of which accepts an integer parameter and assigns it to the corresponding color component. the class, alphachannelcolor-- a subclass of color-- has an integer instance variable, alpha, containing the alpha channel value, representing the degree of transparency of the color. alphachannelcolor also has a method named dissolve (void-returning, and no parameters), that causes the color to fade a bit. it does this by incrementing (by 1) all three color components (using the above accessor and mutator methods) as well as the alpha component value. write the dissolve method.
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, 29.06.2020 14:01
question
Biology, 29.06.2020 14:01
question
Mathematics, 29.06.2020 14:01
question
Mathematics, 29.06.2020 14:01
Questions on the website: 13722363