Question: Using Linked Lists and Priority Queues, implement a C++ program that generates integers and prints them out based on priority. Define a C++ class for

Using Linked Lists and Priority Queues, implement a C++ program that generates integers and prints them out based on priority. Using Linked Lists and Priority Queues, implement a C++ program that generates

Define a C++ class for a basic Expense class which contains 3 pieces of info ID (integer) Amount (double) Priority (integer between 1 and 3) Implement a priority queue data structure with the following public interface e engueue dequeue Queue requirements Each queue element is an expense item with priority category of (1) NECESSITY, (2) BUDGETED and (3) OPTIONAL, the expense amount and ID As a queue, it can only be enqueued at one end and dequeued at the other end with first-in/first-out (FIFO) policy with the exception of priority. A higher priority queue element will always be in the front of the queue before the lower priority one In another words, if I enqueue an expense item of BUDGETED and then follow by the item of NECESSITY, when I dequeue, I will get the item of NECESSITY as it has higher priority to be processed first. It must use linked list as the implementation data structure for the queue All data members in your classes must be declared as "private" Well structure, easy to understand with the proper use of reusable functions, methods and classes Write a queue simulation program Randomly generate a set of expense items (amounts between 100 and 999 along with a priority between 1 and 3 and assigned ID between 1000 to 9999) Create an Item object out of those 3 random generated info and enqueue Once the queue is complete, start dequeuing the Item and print it out. It should be printed in the order of priority. If the elements have the same priority, it should be printed in the order that it is enqueued Run the test with at least 3 set of separate number generations Define a C++ class for a basic Expense class which contains 3 pieces of info ID (integer) Amount (double) Priority (integer between 1 and 3) Implement a priority queue data structure with the following public interface e engueue dequeue Queue requirements Each queue element is an expense item with priority category of (1) NECESSITY, (2) BUDGETED and (3) OPTIONAL, the expense amount and ID As a queue, it can only be enqueued at one end and dequeued at the other end with first-in/first-out (FIFO) policy with the exception of priority. A higher priority queue element will always be in the front of the queue before the lower priority one In another words, if I enqueue an expense item of BUDGETED and then follow by the item of NECESSITY, when I dequeue, I will get the item of NECESSITY as it has higher priority to be processed first. It must use linked list as the implementation data structure for the queue All data members in your classes must be declared as "private" Well structure, easy to understand with the proper use of reusable functions, methods and classes Write a queue simulation program Randomly generate a set of expense items (amounts between 100 and 999 along with a priority between 1 and 3 and assigned ID between 1000 to 9999) Create an Item object out of those 3 random generated info and enqueue Once the queue is complete, start dequeuing the Item and print it out. It should be printed in the order of priority. If the elements have the same priority, it should be printed in the order that it is enqueued Run the test with at least 3 set of separate number generations

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!