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 is 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). 4. Range: Range is the difference between the maximum value and the minimum value in the list. range = 56-5 = 51 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 public static methods: Method name Return type Parameter list and purpose calcMean double (int[] list)->parameter list takes a list argument, calculate and return the mean (average) of the list calcMedian double (int[] list)->parameter list takes a list argument, calculate and return the median value of the list calcMode int[] (int[] list)->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 dont have to follow if you have your own algorithm.) 1. Create a temporary array to hold the list values. **Use deep copy instead of shallow copy, so you wont alter the original array Int[] newList = copyArray(list); **copyArray() is a method that you create to copy value by value from original array to new array (deep copy). You can use a for loop to do this. COSC 1437 Java Assignment 3 DataOperations.docx 2. Sort the newList Arrays.sort(newList) 3. Create a mode array to hold all mode values. **Array is fixed size, you can use the size of list as the size of modes int[] modes = new int[list.length]; 4.Create a frequency array to store the frequency for each value Int[] frequency = new int[list.length]; 5.Use nested for loop to update the frequency array 6. Use frequency array to update the mode array 7. Return mode array calcRange int (int[] list)->parameter list takes a list argument, calculate and return the range of the list calcMax int (int[] list)->parameter list takes a list argument, calculate and return the maximum value of the list. This method is called by calcRange(), and it can be private if you prefer calcMin int (int[] list)->parameter list takes a list argument, calculate and return the minimum value of the list This method is called by calcRange(), and it can be private if you prefer. Assignment Instructions: 1. Create a NetBeans project and named it FirstName_LastName_A3 2. Create a separate java class file named it DataOperations.java. This file contains the public class DataOperations 3. In your main class, create two integer arrays with initialization list (The list is provided below). Use the following data to test your class. Call each data operation method and display the result int[] evenList = {5,38,21,49,56,21,18,21,20,19}; int[] oddList = {5,38,21,49,56,41,18,31,20,19,12}; 4. You can create extra methods to print the results 5. Name your variables clearly 6. Add comments to document your project and code 7. Add space/indentation to make your code easier to read 8. Zip your assignment and submit it in Canvas for grading

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!