Question: Task #4 Calculating the Mean Now we need to add lines to allow us to read from the input file and calculate the mean. Create

Task #4 Calculating the Mean

Now we need to add lines to allow us to read from the input file and calculate the mean.

Create a FileReader object passing it the filename.

Create a BufferedReader object passing it the FileReader object.

Write a priming read to read the first line of the file.

Write a loop that continues until you are at the end of the file.

The body of the loop will:

convert the line into a double value and add the value to the accumulator

increment the counter

read a new line from the file

When the program exits the loop close the input file.

Calculate and store the mean. The mean is calculated by dividing the accumulator

by the counter.

Compile, debug, and run. You should now get a mean of 77.444, but the standard

deviation will still be 0.000.

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!