Roster with Comparators
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →HW04-1 Roster with Comparators • In a new Eclipse project, create class Student with these four instance variables: String lastName, String firstName, int studentID, and int birthDate [as YYYYMMDD [ e.g., 19980420]. Student should have a constructor with four parameters, four getters, and a toString(). [Use Eclipse “source” shortcuts to code all this FAST!] Add a class Main with a main() driver that: 1. builds an ArrayList of called roster with, say, ten unique entries. Take care that your sample data will be initially ordered so that each of the sorts will change the original ordering. 2. defines five lambdas that use Comparator for ordering by: lastname-ascending birthdate-descending [youngest first] studentID ascending, and studentID-descending –Challenge: check java api or some external reference and try to create a fifth lambda using the Comparator interface to sort by birthdate-descending with lastnameascending as a secondary sort if birthdates are equal. Cite the reference you used to get the syntax for this! 3. Invoke sorts with each of the Comparators, and for each, begin by outputting the descriptive name of the Comparator (e.g., “by lastname-ascending”) then display the results. Note: Feel free to organize class Main with some methods like displayList(…), but don’t get carried away. Key idea: “hardwire” each invocation of a sort –e.g.: roster.sort(studentID_desending); We don’t want an elaborate driver for this little exercise! Deliverables: zip of completed Eclipse project and Word doc with screen shots showing output from test run(s). Be sure to include the required Javadoc header declaring any collaboration on this assignment. OOPDA HW04-1 SP23 2/11/2023 1:27 PM
Get a plagiarism-free answer to this question
Send us your instructions and we’ll match you with the best writer in your subject.
- 100% human-written, zero AI
- Turnitin report included
- Confidential — we never share your data
- Free revisions & refunds