Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part 1: Understand the algorithm Given a set of N values (x1 through xn) with mean x, the standard deviation is: (a F) In other
Part 1: Understand the algorithm Given a set of N values (x1 through xn) with mean x, the standard deviation is: (a F) In other words, you need to write two loops: one that computes the mean x, and another that computes the average of the squared differences (i.e., the variance). At the end, take the square root of the variance to determine the standard deviation. 1. Compute the mean and standard deviation for the following numbers by hand: (82, 88, 97, 80, 79, 92 2. Make sure you get 86.3 for the mean and 6.6 for the standard deviation. Think about the algorithm you used Part 2: Creating an array from input values 1. Create two Java classes for today's lab: Main.java with a main method, and Stats.java without a main method. The mairn method will read a series of numbers from System.in, create an array c those numbers, call the mean and standard deviation functions in the Stats class, and then report the results. 2. If the main method is given a command-line argument, that argument will specify the number of values to be read. If no command-line argument is passed, the program should read 25 values. Note that the argument args is an array of Strings. 3. Create an array of double values, using the size from the command-line argument (or 25 as a default, if no argument is 4. Use a loop to read the input values from the keyboard (as doubles) and store them into the array. No prompt should be output 5. Once the array is built, you will pass it to methods in Stats.java. For now, simply print the contents of the aray to make sure 6. To test the program using the command-line argument for the number of values to read in, open a terminal window, navigate See the Integer parselnt) documentation for converting a String to an int. provided). before reading the values. The loop should terminate when the appropriate number of values has been read. your program is working correctly. You may find the Arrays.toString method useful. to your work folder, and enter: java Main 10
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