try {
/*--------------------------------------------------------------*/
Scanner input = new Scanner(System.in);
Scanner reader = new Scanner(new File("path"));
BufferedWriter writer = new BufferedWriter(new FileWriter(new File("path")));
double totalScore = 0, max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
/*--------------------------------------------------------------*/
System.out.print("Enter your name: ");
String name = input.next();
writer.write(name+"\n");
System.out.print("How many scores would you like to enter: ");
int numScores = input.nextInt();
System.out.println("Enter " + numScores + " class score: ");
for(int i = 0; i < numScores; i++) {
double score = input.nextDouble();
totalScore += score;
writer.write(score+"\n");
}
writer.close();
double average = totalScore/numScores;
name=reader.nextLine();
System.out.println(name);
for(int i = 0; i < numScores; i++) {
double num = Double.parseDouble(reader.next());
max = max < num ? num : max;
min = min > num ? num : min;
}
System.out.println("\n" + name + " Average = " + average + "\n" + "Lowest Score :" + min + "\n" + "Highest Score: " + max);
} catch (FileNotFoundException e) {
System.out.println("File does not exist or could not be found.");
System.err.println("FileNotFoundException: " + e.getMessage());
} catch (IOException e) {
System.out.println("Problem reading file.");
System.err.println("IOException: " + e.getMessage());
}
--- Update ---
what is the priority factor?