I need to make a program that reads from a file, to add up 20 scores, from said file and find the mean. Right now I have it reading the values and printing them out, but not adding them up. How would I make it add up all values of "value"
Code:public static void main(String[] args) throws IOException, FileNotFoundException {
processFile("c:\\scores.txt");
}
public static void processFile (String filename) throws IOException, FileNotFoundException {
String line;double value;
BufferedReader inputReader = new BufferedReader (new InputStreamReader(new FileInputStream(filename)));
while (( line = inputReader.readLine()) != null){
value= Double.parseDouble(line);
System.out.println(value);
value=value+value;
}
inputReader.close();
}
}
