Assignment 4 – Priority Queue in C++

Description:

Implement a priority queue capable of determining what order a list of peopleshould be served given a numeric value. The highest priority should be given topersons with larger values (ordered largest to smallest). The priority queue shouldbe written using a C++ class, named PQueue, and the queue itself should beimplemented as a linked list similar to how we implemented queues/stacks inlecture.The following classes should be defined by your program:class Person : Used to store information about each personclass PQueue : Priority queue used to serve peopleThe following public functions need to be implemented:Person::Person( int, string ) : Initialize the personPQueue::PQueue( void ) : Initialize the priority queuebool PQueue::empty( void ) : Test whether queue is emptyint PQueue::size( void ) : Return sizePerson* PQueue::front( void ) : Access next nodePerson* PQueue::back( void ) : Access last nodevoid PQueue::enqueue( Person* ) : Insert nodevoid PQueue::dequeue( void ) : Remove node** Do not change names, as it will interfere with grading.Like your other programs, it will need to read information from a file. The file will bestructure as follows:int stringIt will contain n lines with each line consisting of an integer followed by one spacefollowed by a string. The integer will designate the priority assigned to theparticular person and the string will designate that person’s name.

Get your solution now


Buy now

Comments

Popular posts from this blog

Body Mass Index (BMI) calculator with JUnitTesting in Java

Stack and Queue Implementation with JUnitTesting according to UML