CS 207 Object Oriented Programming
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
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.