Starting from:

$24.99

CS300 Project 9- Patient Record System Solution


Overview
Learning Objectives
The goals of this assignment include:
• Implement common Binary Search Tree (BST) operations.
• Gain more Practice in recursive problem-solving.
• Gain more experience with developing unit tests.
Grading Rubric
15 points Immediate Automated Tests: Upon submission of your assignment to Gradescope, you will receive feedback from automated grading tests about whether specific parts of your submission conform to this write-up specification. If these tests detect problems in your code, they will attempt to give you some feedback about the kind of defect that they noticed. Note that passing all of these tests does NOT mean your program is otherwise correct. To become more confident in this, you should run additional tests of your own.
30 points Manual Grading and Supplemental Automated Tests: When your final grade feedback appears on Gradescope, it will include the feedback from these additional automated grading tests, as well as feedback from human graders who review the code in your submission by hand.
Assignment Requirements and Reminders
• DO NOT submit the provided PatientRecord.java and PatientRecordNode.java source files on Gradescope and DO NOT make any change to their implementations.
• You ARE NOT allowed to add any additional import statements to the provided source files. In particular, you are not allowed to import java.util.List, or java.util.ArrayList, or java.util.Arrays classes.
• You ARE NOT allowed to add any fields either instance or static, and any public methods either static or instance to your PatientRecordTree class.
• You CAN define private methods to help implement the different public methods defined in this programming assignment, if needed.
• ALL your test methods MUST be implemented in your PatientRecordTreeTester class.
• In addition to the required test methods, we HIGHLY recommend (not require) that you develop your additional own unit tests (public static methods that return a boolean).
• Ensure that your code for every assignment is styled in conformance to CS300 Course Style Guide.
1 Getting Started
The provided PatientRecordNode class models the binary nodes which will be used to build and implement our Binary Search Tree (BST) called PatientRecordTree. The specification of this class is provided in the following section.
2 PatientRecordTree and PatientRecordTreeTester Classes
We provide you in the following with the templates for the PatientRecordTree and
PatientRecordTreeTester classes. Download those two files and add them to your project. Notice that we added default return statements to the incomplete methods to simply let the code compile. You are going to complete the implementation of all the methods defined in these classes and including the TODO tag with respect to the details provided in their javadoc method headers. Make sure to remove the TODO tags once you complete the implementation of each method.
Recall that you ARE NOT allowed to add any additional fields either instance or static fields to the PatientRecordTree. Besides, NO additional public methods must be added to this class. Read carefully all the details provided in the javadoc method headers. If a method is described to be a recursive helper method, you are not allowed to implement it using iteration (for or while loops). They MUST be designed and implemented using recursion.
Note that even though it is recommended to declare all the helper methods to be private, we set some of them to be public so that we can call them from our automated test methods.
Finally, we highlight that you are responsible for testing thoroughly your implementation of the PatientRecordTree public methods. You have to define and implement at least the FIVE unit test methods defined in the PatientRecordTreeTester class. Make sure to test every method with at least 3 different scenarios. Hints are provided in the provided javadocs method headers.
Illustrative Example
In order to provide you with a better understanding on how to use the implemented classes, we provide in the following an example of source code and its expected output.

PatientRecordTree bst = new PatientRecordTree();
System.out.println("Size: " + bst.size() + " Height: " + bst.height() + " Contents:"); System.out.println(bst); bst.addPatientRecord(new PatientRecord("Norah", "11/23/1985")); bst.addPatientRecord(new PatientRecord("George", "5/27/1943"));
System.out.println("*****************************************************");
System.out.println("Size: " + bst.size() + " Height: " + bst.height() + " Contents:"); System.out.println(bst);
bst.addPatientRecord(new PatientRecord("Adam", "8/12/1972"));
System.out.println("*****************************************************");
System.out.println("Size: " + bst.size() + " Height: " + bst.height() + " Contents:");
System.out.println(bst);
System.out.println("Oldest patient: " + bst.getRecordOfOldestPatient()); System.out.println("Youngest patient: " + bst.getRecordOfYoungestPatient()); bst.addPatientRecord(new PatientRecord("William", "6/4/1998")); bst.addPatientRecord(new PatientRecord("Sarah", "1/2/1945"));
System.out.println("*****************************************************");
System.out.println("Size: " + bst.size() + " Height: " + bst.height() + " Contents:");
System.out.println(bst);
System.out.println("*****************************************************");
System.out.println("Size: " + bst.size() + " Height: " + bst.height() + " Contents:");
System.out.println(bst);
System.out.println("Oldest patient: " + bst.getRecordOfOldestPatient());
System.out.println("Youngest patient: " + bst.getRecordOfYoungestPatient()); System.out.println("*****************************************************"); try {
System.out.println("Lookup query: search for the patient who’s born on 9/12/2003.");
System.out.println("Search Results: " + bst.lookup("9/12/2003"));
System.out.println("Lookup query: search for the patient who’s born on : 1/10/2000.");
System.out.println("Search Results: " + bst.lookup("1/10/2000"));
} catch (NoSuchElementException e) {
System.out.println(e.getMessage());
}


Expected output:
Size: 0 Height: 0 Contents:
***************************************************** Size: 2 Height: 2 Contents:
George(5/27/1943)
Norah(11/23/1985)
***************************************************** Size: 3 Height: 3 Contents:
George(5/27/1943)
Adam(8/12/1972)
Norah(11/23/1985)
Oldest patient: George(5/27/1943)
Youngest patient: Norah(11/23/1985)
***************************************************** Size: 5 Height: 4 Contents:
George(5/27/1943)
Sarah(1/2/1945)
Adam(8/12/1972)
Norah(11/23/1985)
William(6/4/1998)
Oldest patient: George(5/27/1943)
Youngest patient: William(6/4/1998)
***************************************************** Size: 9 Height: 4 Contents:
Tom(1/2/1935)
George(5/27/1943)
Sarah(1/2/1945)
Adam(8/12/1972)
Norah(11/23/1985)
William(6/4/1998)
Sam(9/12/2003)
Oldest patient: Tom(1/2/1935)
*****************************************************
Lookup query: search for the patient who’s born on 9/12/2003.
Search Results: Sam(9/12/2003)
Lookup query: search for the patient who’s born on : 1/10/2000.
No search results.
3 Assignment Submission

More products