This is a sample Mastery Exam using a Priority Queue with sorting.
Implement a Student class (from scratch):
The tester file is StudentTester.java. Run this with your Student.java and the output should look exactly like StudentTesterOutput.txt.
- The default rate for an Undergraduate student is $1200/class. The default rate for a Graduate student is $500/class.
- If a rate is specified but no status, then the rate determines the type of student. Less than (or equal to) $600/class means Graduate, more means Undergraduate.
- If no rate or status is given, assume Undergraduate with default rate.
- Total tuition = number of classes * rate
- All students start off with no classes registered.
- All students have a student ID number.
Implement a PriorityQueue class (using the provided shell PriorityQueue.java):
The tester file is PriorityQueueTester.java. Run this with your PriorityQueue.java and the output should look exactly like PriorityQueueTesterOutput.txt.
- Write a method filter that takes the two parameters (explained in the comments) and returns a PriorityQueue containing all Students whose status is equal to the String parameter and total tuition is less than the double.
- The insert method takes one parameter, the new student. It must determine if the student is already in the PriorityQueue. If not, it stores the new student in the PriorityQueue IN ORDER by student ID. (The lowest number should be at 0, the highest should be at the highest index.) If the student is already in the array, it will replace their information with the new information. (For example, a student's tuition price could change, or he or she could change status.) Note: you can tell if a student is unique by the ID. If you get two students with the same ID and different names it means update the name for the given ID.
- The remove method takes one parameter specifying the ID of the student it is looking for (int). It removes the Student by searching the array for the key. If not found, the array remains unchanged. If found, the assiociated Student is removed, and all students after are shifted back (leave no holes).