Priority Queue from a Heap.

In this lab you will implement a Priority Queue from a Heap. You will use your Priority Queue with the student class to output the students two different ways.

You are provided with 10 files:

PriorityQueueDriver.cpp
Key.h
Heap.h
Priority.h
PriorityQueue.h
Classification.h
Classification.cpp
Student.h
Student.cpp
students.txt
You will need to implement the following: an abstract class Priority in Priority.h, a priority queue in PriorityQueue.h, and the main program in PrioirtyQueueDriver.cpp. The files Key.h, Heap.h, Classification.h, Classification.cpp, Student.h and Student.cpp have been coded and are read only. You do not need to make an implementation changes to these files. The definition for the PriorityQueue class is already coded for you. You will need to code up the method implementations.

Part 1: Complete Priority.h
In the file Priority.h, you should declare two pure virtual methods that will be used by the priority queue. Make sure you do each of the following.
1 Write a method declaration for the getter. Use the signature virtual int getPriority() = 0;
2 Write a method declaration for the setter. Use the signature virtual void setPriority(int priority) = 0;
Note: This abstract class will only have two methods.

Part 2: Implement the PriorityQueue class
In the file PriorityQueue.h, you should implement a generic priority queue. Make sure you do each of the following.
Note: The class definition is already completed. A generic Heap is being used to store your nodes for the priority queue. The two constructors for the class have also been completed. You need to complete the implementation of the methods below the constructors.

Part 3: Implement PriorityQueueDriver functions main() and heapSort()
In the file PriorityQueueDriver.cpp implement the functions main() and heapSort().
1
int main()
You should do the following in main

  1. Declare a PriorityQueue
  2. Pass your PrioirtyQueue variable to readInData(…)
  3. Pass the value true to the Student class method setUsePriority(…)
  4. Output all the students in priority order (See output example below).
    Note: Before output any data, execute the following code: cout

Comments from Customer
FORMAT: 1:priority
Your output starts with

Students in priority order:
4038 3.255 Doctoral Candidate
1220 2.719 Doctoral Candidate
8620 3.618 Doctoral Candidate
8314 3.852 Graduate student
1469 2.869 Graduate student
4835 4 Graduate student
8241 3.501 Senior
2048 2.35 Senior
2006 2.48 Junior
1874 1.877 Sophomore
4492 2.698 Sophomore
3833 3.372 Freshman

Students descending sort by GPA:
:4835 4 Graduate student
8314 3.852 Graduate student
8620 3.618 Doctoral Candidate
8241 3.501 Senior
3833 3.372 Freshman
4038 3.255 Doctoral Candidate
1469 2.869 Graduate student
1220 2.719 Doctoral Candidate
4492 2.698 Sophomore
2006 2.48 Junior
2048 2.35 Senior
1874 1.877 Sophomore

Expected output starts with

Students will register in the following order:
1220 2.719 Doctoral Candidate
8620 3.618 Doctoral Candidate
4038 3.255 Doctoral Candidate
4835 4.000 Graduate student
8314 3.852 Graduate student
1469 2.869 Graduate student
2048 2.350 Senior
8241 3.501 Senior
2006 2.480 Junior
4492 2.698 Sophomore
1874 1.877 Sophomore
3833 3.372 Freshman

2:heapsort
Your output ends with:

man

Students descending sort by GPA:
:4835 4 Graduate student
8314 3.852 Graduate student
8620 3.618 Doctoral Candidate
8241 3.501 Senior
3833 3.372 Freshman
4038 3.255 Doctoral Candidate
1469 2.869 Graduate student
1220 2.719 Doctoral Candidate
4492 2.698 Sophomore
2006 2.48 Junior
2048 2.35 Senior
1874 1.877 Sophomore

Expected output ends with

Students descending sort by GPA:
4835 4.000 Graduate student
8314 3.852 Graduate student
8620 3.618 Doctoral Candidate
8241 3.501 Senior
3833 3.372 Freshman
4038 3.255 Doctoral Candidate
1469 2.869 Graduate student
1220 2.719 Doctoral Candidate
4492 2.698 Sophomore
2006 2.480 Junior
2048 2.350 Senior
1874 1.877 Sophomore

find the cost of your paper

This question has been answered.

Get Answer