Question: Provide static mean, median, mode and range for a set of data Specification Design a class that can calculate the static mean, median, mode and
Provide static mean, median, mode and range for a set of data Specification Design a class that can calculate the static mean, median, mode and range for a list of integers. The class contains no constructors, only a set of static methods to perform the above data operations. Here is how to perform each data operation: Example: the list of integers: 10,23,56,5,37,10 1. Mean (average): mean (10+23+56+5+37+10)/6 (size of the list) 23.5 2. Median: If the count of the list is odd number, use the middle value. If the count of the list is even number, then average the middle two values. The list must be sorted before calculating the median value Sorted list: 5,10,10,23,37,56. median (10+23)/2 16.5 3. Mode: Mode is the number that appears most often in the list. 10 has 2 occurrences in the list.So the mode s 10 in this example. You might encounter no mode value (if every value has only one occurrence in the list, for instance a list of 1,2,3,4,5 has no mode value) or multiple mode values (if there are more than 1 number has the same highest frequency, for instance a list of 10,24,34,10,24 has two mode values: 10, 24) Range: Range is the difference between the maximum value and the minimum value in the list. range 56-5-51 4. Class Design: You may add any additional variables and methods to implement the logic of your solution. Class Name: DataOperations Private data members (properties): none Constructors: none ic static methods: Met hod name Return type Parameter list and purpose double (int[] list)->parameter list takes a list argument, calculate and return the mean (average) of the list (int[] list)->parameter list takes a list argument, calculate and return the median value of the list (int] 1ist)->parameter list takes a list argument, calculate and return all mode values of the list. You can have 0 or more mode values. Some Hint: (You don't have to follow if you have your own algorithm.) 1. Create a temporary array to hold the list values. calcMean calcMedian double calcMode int Use deep copy instead of shallow copy, so you won't alter the original array Intil newList copyArray(list)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
