-3

Here is what I have so far. I need to use the number from a text file.

Calculations class:

public class Calculations {

    public void readFile(String fileName, double[] myArray) throws Exception {
        FileReader fr = null;
        BufferedReader br;

    }

    public double computeStandardDeviation(double[] myArray) {
        double result = 0;

        return result;
    }

}

Main class:

public class Main {
    private static int NUMBERS=20;

    public static void main(String[] args) {
        double[] myNumbers =  new double[NUMBERS];
        Calculations calculations = new Calculations();
        try {
            calculations.readFile("numbers.txt", myNumbers);
            double stdDev = calculations.computeStandardDeviation(myNumbers);
            System.out.println("Population Std Dev = " + stdDev);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
Jonny Henly
  • 4,023
  • 4
  • 26
  • 43
song
  • 1
  • 2
    Welcome to Stack Overflow, please review [How do I ask a good question?](http://stackoverflow.com/help/how-to-ask) – Jonny Henly Nov 15 '16 at 23:48

1 Answers1

1

First, calculate the sum. Then, calculate the average square difference between each number and the mean. Return the root of this average.

Gavin Haynes
  • 1,721
  • 11
  • 21
  • I believe this actually is an answer. The question is "How to calculate population standard deviation" and Gavin Haynes actually answers this question. @GavinHaynes, could you please elaborate a bit more, so there is no doubt that you answer the question? [- From Review](http://stackoverflow.com/review/low-quality-posts/14300903) – xenteros Nov 16 '16 at 08:42