
Sarah P.
asked 07/25/20Try to solve this problem please
You are given a data file which contains data for creating student objects.
See the attached “students.txt” file.
Also, for your convenience, ‘Utility.class’ is attached.
However, it is not completed yet. You need to complete it.
Once you complete it, you can use it for printing and loading data from
the data file.
Use the modified Insertion Sorter in Problem 1, sort those students in
their natural order.
https://jrjava.net/assessment/adv/assessment013/Utility.java
https://jrjava.net/assessment/adv/assessment013/students.txt
1 Expert Answer

Patrick B. answered 07/27/20
Math and computer tutor/teacher
Once again, I have uploaded the source code for you, under this link.
As before, I had to upload it to the RESOURCES SECTION, which is found
(for me anyways) under the TOOLKIT menu, however yours may differ.
This bundled file contains THREE (3) source code files...
(1) Student.java
(2) StudentSort.java
(3) StudentMain.java
Break the text file into these three source code files, compile them, and run via the command:
java StudentMain
Summary of changes:
(1)
I had to change the Student.parse() method so that it accepts two extra parameters:
(a) a String containing the delimiter around which to parse
(b) a boolean flag that specifies the order of the names in the record buffer
Recall that the previous version parses a CSV (comma separated values). However,
the records in your input file are delimited by whitespace which fills up the array of tokens
with blank strings. I had to go in there, count the # of good tokens and transfer them into
the array.
(2) I moved the sorting routines into a separate class
(3) Added a dummy constructor to Student.java
(4) Added a method in StudentMain.java to read the student records from input file.
The routine reads 1000 records or EOF, whichever happens first and stores them
in the array for sorting.
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Patrick B.
or email if necessary07/27/20