An airline company uses the formula shown below to determine the priority of passengers on the waiting list for overbooked flights.
priority number =A / 1000 + B - C
where
A is the customer's total mileage in the past year
B is the number of years in his or her frequent flier program
C is a sequence number representing the customer's arrival position when he or she booked the flight
Given a file of overbooked customers as shown in Table 9-2, write a program that reads the file and determines each customer's priority number. The program then builds a priority queue using the priority number and prints a list of waiting customers in priority sequence.
Name
|
Mileage
|
Year
|
Sequence
|
Bryan Devour
|
53,000
|
5
|
1
|
Amanda Trapp
|
89,000
|
3
|
2
|
Boclan Nguyen
|
93,000
|
3
|
3
|
Sarah Hong
|
17,000
|
1
|
4
|
Warren Raxrcod
|
72,000
|
7
|
5
|
Jorge Gonzales
|
65,0000
|
2
|
6
|
Paula Hong
|
34,000
|
3
|
7
|
Lou Mason
|
21,000
|
6
|
8
|
Stave Chu
|
42,000
|
4
|
9
|
Dave Lightfoot
|
63,000
|
3
|
10
|
Joanne Brawn
|
33,000
|
2
|
11
|