Question: Part 0 1 - Compute Average For this part you must write a public static method named getAverage. This method will take an ArrayList as
Part Compute Average
For this part you must write a public static method named getAverage. This method will take an ArrayList as an argument, and it will return as a double the average of all the values in the Arraylist. Remember that to compute the average of a list of values, you will need to first get the sum total of all the values, and then divide by the count the number of values in the list
After you have finished wring this method, Run your code to find and then fix any syntax errors. You may also wish to write some other code in the main method to call and test your methods When you are confident that your method is structurally and logically correct, then submit your code to the autograder for feedback. Your code should pass Structure test and Logic tests and before you continue.
Part Find Min
For this part you must write a public static method named getMin. This method will take an ArrayList as an argument, and it will return as a double the minimum of all the values in the Arraylist. Remember that to find the minimum of a list of values, you will need to search through the list and keep track of the smallest value you have seen so far.
After you have finished wring this method, Run your code to find and then fix any syntax errors. You may also wish to write some other code in the main method to call and test your methods When you are confident that your method is structurally and logically correct, then submit your code to the autograder for feedback. Your code should pass Structure test and Logic tests and before you continue.
Part Find Max
For this part you must write a public static method named getMax. This method will take an ArrayList as an argument, and it will return as a double the maximum of all the values in the Arraylist. Remember that to find the maximum of a list of values, you will need to search through the list and keep track of the largest value you have seen so far.
After you have finished wring this method, Run your code to find and then fix any syntax errors. You may also wish to write some other code in the main method to call and test your methods When you are confident that your method is structurally and logically correct, then submit your code to the autograder for feedback. Your code should pass Structure test and Logic tests and before you continue.
Part Center Data
For this part you must write a public static method named center. This method will take an ArrayList as an argument, and it will have no return value. To center the data, you must subtract the average from each value in the list.
For example, given this data the average is ; when we subtract this average from each value in the list, the list will now look like this
Note that this method does not need to return anything because it will be directly editing the values in the ArrayList that is passed by reference as an argument to the method.
After you have finished wring this method, Run your code to find and then fix any syntax errors. You may also wish to write some other code in the main method to call and test your methods When you are confident that your method is structurally and logically correct, then submit your code to the autograder for feedback. Your code should pass Structure test and Logic tests and before you continue.
Part Scale Data
For this part you must write a public static method named scale. This method will take an ArrayList and a double as arguments, and it will have no return value. The first argument the ArrayList will contain the list of values to scale, and the second argument the double will be the new range. To scale the data, you must do the following:
compute the current range of the data in the argument ArrayList. The range is the max value in the list minus the min value in the list.
compute the scale factor needed to rescale the data. The scale factor will be the new range divided by the current range
scale each value in the list. To scale a value, you multiply the value by the scale factor.
For example, given
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
