Question: ReadAFile.java import java.io.*; public class ReadAFile { public static void main(String[] args) throws FileNotFoundException, IOException { // 1. opening the file for reading FileReader f

 ReadAFile.java import java.io.*; public class ReadAFile { public static void main(String[]

ReadAFile.java

import java.io.*; public class ReadAFile { public static void main(String[] args) throws FileNotFoundException, IOException { // 1. opening the file for reading FileReader f = new FileReader("Grades.txt"); BufferedReader in = new BufferedReader(f); // 2. reading lines of text from the file String line = in.readLine(); while (line != null) { System.out.println(line); line = in.readLine(); } // 3. closing the file f.close(); } }

Grades.txt

Cinderella 78 89 87 60 56 Shrek 87 88 89 Pinocchio 60 56 80 77 Fiona 86 92 98

Task #1 The Top Average Grade (10 pts). Write a Java program that has one public static method that + 1. Reads from a file information about grades obtained by students in a semester Calculates and prints to the console an average grade for each student, 3. Determines the highest average grade,' 4. 2. Prints to the console a string representing the name of the student with the highest average grade and the highest average grade.* Data in the file are organized as follows:- Cinderella 78 89 87 60 56 Shrek 87 88 89 Pinocchio 60 56 80 77 Fiona 86 92 98 Example of the program output is Cinderella Shrek Pinocchio Fiona average: 74.0 average: 88.0 average: 68.25+ average: 92.04 TOP Student is Fiona with the highest average grade: 92.0 Name of the file with data is Grades.txt and it must be hardcoded. Use the ReadAFile.java sample code to get you started. Data in Grades.txt file may be different from the example, but it is expected that it is organized exactly the same way. ' You program will be tested with different set of data, so do not reproduce only output part of the task. Do not submit code that generates compilation errors, it will not be graded

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!