CS 207 Object Oriented Programming
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →CS 207 – Homework 3 Download HW3 files. To submit, follow the syllabus guidelines. Sorted Linked List Exercise (65 pts) Implement your code: In this question, you are required to implement a sorted linked list, sorted according to a person’s m_ID field. You must complete 4 methods in the class: SortedPersonList. You will be given two files, SortedPersonList.java and PersonNode.java. Implement these 4 methods: ● contains(int ID) – this method takes an ID and checks whether a PersonNode associated with the given ID is in the list. If so, return true, otherwise, return false. ● get(int ID) – This method takes an ID and checks whether a PersonNode associated with the given ID is in the list. If so, return the reference to the node, otherwise, return null. ● add(int ID, String name) – This method takes an ID and a name and adds a PersonNode with these values into the list. The list must still be sorted in ascending order by ID numbers. If add is successful, return true. If the node already exists in the list, return false. ● remove(int ID) – This method takes an ID and remove a PersonNode associated with the given ID from the list. If remove is successful, return true. If no such node exists, return false. Test your code: You are provided with a test driver implemented in “TestPersonList.java” (do not make any changes to this file!) so there is no need to write your own testing code. Once you have completed the above classes, you can run the test. You should create a plain text file named “output.txt”, copy and paste the output (if your code crashes or does not compile, copy and paste the error messages) to this file and save it. Grading Rubric: ● ● ● ● ● code does not compile: -10 code compiles but crashes when executed: -5 changes were made outside of the required methods: -5 has output file: 4 passes 33 test cases (2 pts each, 66) Sample Output: Test 1: size() ==> [Passed] Expected: 0 Yours: 0 Test 2: add(1003, “Kungfu Panda”) ==> [Passed] Expected: true Yours: true Test 3: isEmpty() ==> [Passed] Expected: false Yours: false … Test 32: remove(1003) ==> [Passed] Expected: true Yours: true Test 33: size() ==> [Passed] Expected: 2 Yours: 2 Total test cases: 33 Correct: 33 Wrong: 0
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