Question
Im having trouble getting my program to work. i keep getting an error when trying to include the mean into my standard deviaiton method. Write
Im having trouble getting my program to work. i keep getting an error when trying to include the mean into my standard deviaiton method.
Write a program that prompts the user for 10 floating point values. The program should invoke two methods to calculate the mean and standard deviation of the numbers. You can use the formula below to calculate the mean and standard deviations.
You will need:
A scanner object to read the 10 values
An array to store the ten values
Two methods that do the following:
Accepts an array and returns the mean
Accepts an array and returns the standard deviation
A sample of the output is shown below
Enter ten numbers: 1.9 2.5 3.7 2 1 6 3 4 5 2 The mean is 3.1100000000000003 The standard deviation is 1.5573838462127583
System. out. println the mean is mean (list2 System. out. println the standard deviation is SD (list2 public static double mean (double array) calculates mean and returns value double sum 0; for int i 0 i Karray length itt) sum array [i] return sum array length; public static double SD double array) calculates standard deviation double d 0 for (int i 0: i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started