Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

ISBN: 0619064625, 978-0619064624

More Books

Students also viewed these Databases questions