The NursingSelection
program is a Java application designed to simulate the selection process of students for a nursing program based on various academic criteria. It uses a binary tree to evaluate each student's qualifications and a simple scoring system to determine their eligibility.
The program consists of the following classes and nested static classes:
-
NursingSelection
- This is the main class that contains the
main
method and other helper methods such asgenerateRandomName
to support the simulation of the student selection process.
- This is the main class that contains the
-
Node
- This nested static class represents the nodes of a binary tree, each holding a criterion, a weight, and references to child nodes.
-
BinaryTree
- Another nested static class which represents the decision-making structure with a root node and a method
evaluateGPA
to assess student criteria against the tree structure.
- Another nested static class which represents the decision-making structure with a root node and a method
-
Student
- This nested static class encapsulates student data including name, score breakdown, and total score.
The binary tree is used to model the decision criteria:
- The root node checks if a student has all prerequisites.
- The left subtree checks science GPA related criteria.
- The right subtree checks non-science GPA related criteria.
Each leaf node represents a terminal criterion with an associated weight.
The program generates a list of 1000 students with random names and randomly determined criteria. Each student's qualifications are evaluated against the binary tree structure to calculate their total score.
The code is structured as a single Java file with multiple nested classes to represent the program's logic. It uses standard Java libraries and the org.json
library to handle JSON operations.
- The program requires Java 8 or higher to run.
- The program requires the
org.json
library to generate JSON files. (can be included as a Maven or Gradle dependency if you are using a build tool)
To run the NursingSelection
program:
- Ensure you have Java installed on your system.
- Compile the Java file:
javac NursingSelection.java
- Run the program:
-
java NursingSelection
- The program will generate a list of 1000 students and display the top 10 students with the highest scores.
- The program will also generate two JSON files:
selected.json
contains the list of selected students.rejected.json
contains the list of rejected students.- Each JSON file contains the student's name, total score, and score breakdown.
{"selectedCandidates": [
{
"scoreBreakdown": {
"hasAllPreReqs": 20,
"nonScienceGPAGreaterThan2_5": 25,
"hasAaAs": 10,
"scienceGPAGreaterThan3_0": 25,
"teasScoreGreaterThan62": 20
},
"name": "William Hamilton",
"totalScore": 100
},
{
"scoreBreakdown": {
"hasAllPreReqs": 20,
"nonScienceGPAGreaterThan2_5": 25,
"hasAaAs": 10,
"scienceGPAGreaterThan3_0": 25,
"teasScoreGreaterThan62": 20
},
"name": "Steven Patterson",
"totalScore": 100
}
]}
{"rejectedCandidates": [
{
"scoreBreakdown": {
"hasAllPreReqs": 20,
"nonScienceGPAGreaterThan2_5": 25,
"hasAaAs": 0,
"scienceGPAGreaterThan3_0": 0,
"teasScoreGreaterThan62": 0
},
"name": "Dorothy Smith",
"totalScore": 45
},
{
"scoreBreakdown": {
"hasAllPreReqs": 20,
"nonScienceGPAGreaterThan2_5": 25,
"hasAaAs": 0,
"scienceGPAGreaterThan3_0": 25,
"teasScoreGreaterThan62": 0
},
"name": "Mary Johnson",
"totalScore": 70
}
]}
This project is licensed under the MIT License - see the LICENSE file for details.