Write a program that computes the average and standard deviation of the text floating point numbers in a file. Use the following formulas for the average and the standard deviation of N values. The formulas compute the sum, the sum of squares, the average, the average square, the variance, and finally, the standard deviation.
sum = x1 + x2 + x3 + ... + xN-1 + xN

sumSQ = x12 + x22 + x32 + ... + xN-12 + xN2

avg = sum/N

avgSQ = avgSQ/N

var = avgSQ - avg2

sd = var(1/2)
The input file will contain any number text floating point numbers, similar to the following:
10.5
12.9
9.67
12.05
8.23
10.08
10.23
7.7
10.4
11.34
Numbers could be several, or none per line, and negative numbers are perfectly OK.

Recommended Answers

All 2 Replies

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in coding your homework for you.

DaniWeb Member Rules include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"
http://www.daniweb.com/forums/faq.php?faq=daniweb_policies
http://www.daniweb.com/forums/announcement8-2.html

Also, re the May 2009 thread that you posted to:

DaniWeb Member Rules include:
"Do not hijack old threads by posting a new question as a reply to an old one"
http://www.daniweb.com/forums/faq.php?faq=daniweb_policies

for my opinion, read my answer in the 2009 thread you hijacked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.