Question: Write a Java program to read student data from a text file. This file is in the format: Student ID (int) Full name (last, first)

Write a Java program to read student data from a text file. This file is in the format:

Student ID (int) Full name (last, first) (String) Test score (double)

We need to process this data: Read data from the file. Calculate the average score for the group. Determine whether a particular score is greater than, equal to or less than the average. Derive a letter grade for each numeric score Calculate the standard deviation of the group of scores. Display output as shown in the sample below.

Because of this, well need to maintain lists of data in memory. We could use arrays of IDs, names, scores, etc.; however, the trend is to use more flexible structures like ArrayLists, Vectors or LinkedLists because, unlike fixed size arrays, they can expand to hold more data as needed.

The rules for deriving a letter grade are: Numeric grade >= 90, A Numeric grade >= 80 and < 90, B Numeric grade >= 70 and < 80, C Numeric grade >= 60 and < 70, D Numeric grade, 60, F

Of course you know how to express these rules in code without using compound conditions, right?

Calculating a standard deviation: Calculate the average for the group Subtract the average from each score (Score - Average) and raise it to the second power (Score - Average)^2 Sum the previous values of (Score - Average)^2 Divide this sum by the number of scores minus 1 Take the square root of the previous value

See the example below:

Student Score Score - Average (Score - Average)^2 Roth, Philip 80 3.5 12.25 McCall-Smith, Alexander 75 -1.5 2.25 Baldacci, David 70 -6.5 42.25 Garcia Marquez, Gabriel 90 13.5 182.25 Grisham, John 75 -1.5 2.25 DeLillo, Don 85 8.5 72.25 Borges, Jorge 95 18.5 342.25 Patterson, John 70 -6.5 42.25 Sparks, Nicolas 60 -16.5 272.25 Brown, Dan 65 -11.5 132.25

Sum 765 1102.5

Average 76.5

Count - 1 9

Sum((Score - Average)^2)/(Count - 1) 122.5

=SqRoot( 122.5 ) 11.06797

Check using Excel's stdev function 11.06797

Sample output: Group average: 76.5 Standard deviation: 11.06797

Relative to Letter Student Score Average Grade

Roth, Philip 80 > Average B McCall-Smith, Alexander 75 < Average C Baldacci, David 70 < Average C

Youll probably need to use System.out.printf to produce well-aligned output

.txt file as follows:

1000 Roth, Philip 80 2000 McCall-Smith, Alexander 75 3000 Baldacci, David 70 4000 Garcia Marquez, Gabriel 90 5000 Grisham, John 75 6000 DeLillo, Don 85 7000 Borges, Jorge 95 8000 Patterson, John 70 9000 Sparks, Nicolas 60 10000 Brown, Dan 65

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!