Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:40, nsuleban9524
When you type the pwd command, you notice that your current location on the linux filesystem is the /usr/local directory. answer the following questions, assuming that your current directory is /usr/local for each question. a. which command could you use to change to the /usr directory using an absolute pathname? b. which command could you use to change to the /usr directory using a relative pathname? c. which command could you use to change to the /usr/local/share/info directory using an absolute pathname? d. which command could you use to change to the /usr/local/share/info directory using a relative pathname? e. which command could you use to change to the /etc directory using an absolute pathname? f. which command could you use to change to the /etc directory using a relative pathname?
Answers: 3
image
Computers and Technology, 23.06.2019 22:50, atifgujar
An environmental protection agency study of 12 automobiles revealed a correlation of 0.47 between engine size and emissions. at 0.01 significance level, can we conclude that there is a positive association between the variables? what is the p value? interpret.
Answers: 2
image
Computers and Technology, 23.06.2019 23:00, minosmora01
How do you know if the website is secure if you make a purchase
Answers: 2
image
Computers and Technology, 24.06.2019 04:30, minecrafter3882
Fall protection, confined space entry procedures, controlled noise levels, and protection from chemical hazards are some of the things that contribute to a safe what
Answers: 1
Do you know the correct answer?
For this assignment, you will complete two separate classes which will be used to find statistics fr...

Questions in other subjects:

Konu
Biology, 30.12.2019 23:31
Konu
World Languages, 30.12.2019 23:31