A data file named "sat.txt" contains the SAT scores of students. Each record includes the student's identification code, last name, first name, SAT math score, and SAT verbal score. Write a program to read this data file and generate a neatly formatted report listing each student's name, math score, verbal score, and combined score.
In the spirit of object-oriented programming, I have provided you with a Student class to use with your program. Download the Student.class file (right-click on the link and choose the "Save Link As..." option in Firefox or the "Save Target As..." option in Internet Explorer") and save it in the same folder as your application program. Don't try to open this file because it is the compiled version of my Student class implementation which is all you need in order to use the Student class. As long as it is in the same folder as your program, BlueJ will be able to find it and use it. Here is a link to the documentation for the Student class: Student Class Documentation.
Use a Student object to store a student's data. Use the setter methods to copy the values read from the file to the student object. Use the getter methods when you are ready to output the student's data to the table.
The output is in the form of a table which consists of two lines of headings followed by the data from the file. The records from the file will be displayed one record per line in the table. Here are the first four lines of the table:
Name Math Verbal Combined ------------------ -------- -------- -------- Smith, Linda 560 610 1170 Spratt, Bill 490 560 1050
The name column is 18 characters wide and the columns for the SAT scores are each 8 characters wide. The space between columns is 2 characters wide.
The file contains an unknown number of records. Each line of the file contains a single record which consists of a student identifier, the student's last name, the student's first name, the student's SAT Math score, and the student's SAT Verbal score. The fields within a record are separated by one or more spaces. Here are the first two records from the data file:
LS1243 Smith Linda 560 610 BS3194 Spratt Bill 490 560
I've provided a sample file for you. Just right-click on this sample file link, and select the "Save Link As..." option in Firefox or the "Save Target As..." option in Internet Explorer and save the file to your project folder. Of course, you could also create your own data file if you want.
I suggest that you create a single concatenated string combining the last name, a comma, a space, and the first name and then print this string in the name column of the table. You can use the format method to display the name left-justified in the name column.
The combined SAT score is simply the sum of the math score and the verbal score.
Submit your Lab10.java application as an attachment to an email message whose subject is "Lab10".