Question: Priority Queue: (C++) An airline company uses the formula shown below to determine the priority of the passengers on the waiting list for overbooked flights.

Priority Queue: (C++)

An airline company uses the formula shown below to determine the priority of the passengers on the waiting list for overbooked flights. Priority number = A / 1000 + B C, Where, A is the customers total mileage in the past year B is the number of years in her or his frequent flier program C is the sequence number representing the customers arrival position when s/he booked the flight (the first customers sequence number is 1, second in the file is 2, and so on). Build the heap based on the serial number: serial number = priority * 100 + (100 C) Given a file with overbooked customers, overbooked.txt, write a program that reads the file and determines each customers priority number and prints a list of waiting customers (name and their priority and serial numbers) in priority sequence, including the number of customers. A line in the input file contains the number of years in the frequent flier program, total mileage in the past year, and the name of the customer (see below)

5 53000 Robert Hill

3 89000 Amanda Trapp

3 93000 Jonathan Nguyen

5 53000 Tom Martin

1 17000 Mary Lou Gilley

3 89000 Bob Che

7 72000 Warren Rexroad

2 65000 Vincent Gonzales

3 34000 Paula Hung

6 21000 Lou Masson

4 42000 Steve Che

3 89000 Linda Lee

3 63000 Dave Lightfoot

5 53000 Sue Andrews

2 33000 Joanne Brown

7 99000 Paul Ng

5 53000 Steven Chen

2 65000 Vladimir Johnson

7 72000 Peter Edwards

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!