Question: JAVA: Write A Student Class that reads a text file that contains the names of students and their grades separated by a comma. Use a

JAVA: Write A Student Class that reads a text file that contains the names of students and their grades separated by a comma.

Use a comparator. The comparable is for finding the average score for each student. Get the average method used to compare.

Put the student object in an array. Sort using the Comparable (Sort Command). Print the Top three Students and their score.

scores.txt looks like this:

John,80,90,70,80

Kim,80,60,70,55

Sam,55,90,66,80

Mary,80,45,75,80

Terry,10,30,14,59

Justin,15,12,15,30

Brett,99,88,66,77

Mike,100,100,100,100

Tedd,44,55,87,12

Cannot use Maps.

The scores.txt can be extended to include more students and their grades.

The results can look like this:

John: 80.0

Kim: 66.25

Sam: 72.75

Mary: 70.0

Terry: 28.25

Justin: 18.0

Brett: 82.5

Mike: 100.0

Tedd: 49.5

1 = Mike 100

2 = Brett 82.5

3 = John 80

Highest Avg = Mike

Mike

Brett

John

Sam

Mary

Kim

Tedd

Terry

Justin

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!