0

hi i have made a program to find average and standard deviation. n it read input from other. rest of things are fine plz guide me my output for Standard deiation sD comes NaN. i have searched alot bt couldnot find solution

my code is

```
import java.io.*;
import java.util.*;
public class JephreyCuma {
/** Creates a new instance of JephreyCuma */
ArrayList list = new ArrayList();
public JephreyCuma() {
}
/**
* @param args the command line arguments
*/
public void fileReader(){
String line="";
try{
BufferedReader inp = new BufferedReader(new FileReader("c:/Users/dfff/Java/abc.txt"));
line = inp.readLine();
int number=0;
while(line!=null){
list.add(line);
line = inp.readLine();
}
}catch(Exception e){
System.out.println("Error converting "+line+" into number");
}
}
public double findArithmeticMean(){
double mean =0;
int sum=0;
for(int index=0;index<list.size();index++)
sum=sum+Integer.parseInt((String)list.get(index));
mean = sum/list.size();
return mean;
}
public double findSD(){
double sum=0;
double sumSQ=0;
double numSQ=0;
double avgSQ=0;
double var=0;
double SD=0;
for(int i=0;i<list.size();i++){
int num = Integer.parseInt((String)list.get(i));
double mean =0;
for(int index=0;index<list.size();index++)
sum=sum+Integer.parseInt((String)list.get(index));
mean = sum/list.size();
sum=sum+num;
numSQ=num*num;
sumSQ=sumSQ+numSQ;
avgSQ=sumSQ/list.size();
var=avgSQ-(mean*mean);
SD=Math.sqrt(var);
}
return SD;
}
public static void main(String[] args)throws IOException {
// TODO code application logic here
JephreyCuma jeph = new JephreyCuma();
jeph.fileReader();
System.out.println("Here is the standard deviation number: "+jeph.findSD());
System.out.println("Here is the Arithmetic mean: "+jeph.findArithmeticMean());
}
}
```