Question: ** In Java with detailed comments ** ** In Java with detailed comments ** Assignment 9 Write a generic class MyMathClass with at type parameter

** In Java with detailed comments **

** In Java with detailed comments ** ** In Java with detailed

comments ** Assignment 9 Write a generic class MyMathClass with at type

** In Java with detailed comments **

Assignment 9 Write a generic class MyMathClass with at type parameter T where T is a numeric object (Integer, Double or any class that extends java.lang.number) Add a method standardDeviation (stdev) that takes an ArrayList of type T and returns a standard deviation as type double. Use a for each loop where appropriate Hard code a couple of test arrays into your Demo file. You must use at least 2 different types such as Double and Integer Your call will be something like System.out.println("Standard Deviation 0-9 Your class and method headers will be public class MyMathclass MyMathClass.stdev (a)) public static double stdev (ArrayList a) Research java' s Number class to see what useful method we are gaining access to Standard Deviation is the average amount of deviation from the average See len.wikipedia ndard deviation The formula that must be implemented is Where the x with a bar over it is the average. The greek letter sigma stands for a summation. So you need to take each element in the array, subtract the average from it, square it and add this number to a total. After you take the total divide by the number of elements 1 and take the square root. Example If the Input is123456789 10 The averago is 5s The result fox the total would be: 1-5.5) (2-5.5) +(2-5.5) (2-5.5) +(3-5.5) (3-5.5)+ Then divide this by N-1 or 9 and take the square root Excal gives: 3.3 as the standard daviation. +(105.5) 110-5.5

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!