Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

** 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 **

image text in transcribed

image text in transcribed

** 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.printIn("Standard Deviation 0-9 + MyMathClass.stdev (a)); Your class and method headers will be public class MyMathclass 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 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 average is 5s The result for 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

5. Describe the relationship between history and identity.

Answered: 1 week ago