Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a priority queue capable of determining the order in which a group of people should be admitted to a concert based off of the

image text in transcribed
image text in transcribed
Implement a priority queue capable of determining the order in which a group of people should be admitted to a concert based off of the number designated on their ticket. The highest priority should be given to those individuals with the lowest ticket numbers. Your program should read a file containing ticket information and print the order in which individuals should be admitted into the concert. Be careful, the ticket numbering system sometimes prints duplicates. If this case should arise both guests will be admitted into the concert. The guest who arrived first (listed first in the file) will receive a higher priority, and so on. Output from your program should match the example demonstrated at the end of this file. Your priority queue should be written using a C++ class, named PQueue, and the queue itself should be implemented as a linked list similar to how we implemented queues/stacks in lecture. The following classes should be defined by your program class Person : Used to store information about each person (ticket # and name) class PQueue Priority queue used to serve people The following public functions need to be implemented: Person: :Person int, string): Initialize the person PQueue: : PQueue ( voidInitialize the priority queue bool PQueue: :empty voidTest whether queue is empty int PQueue:: size( void:Return size Person PQueue::front ( void ): Access node at front of queue Person PQueue::back void): Access node at end of queue void PQueue: :enqueue Person*Insert node into proper location in queue void PQueue: :dequeue( void : Remove node from front of queue 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 be structured as follows int string

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions