Data Abstraction and Structures Lab Heap ADT Project 10.10 Lab: Heap ADT
Now that you have a working implementation of the Heap class, you will convert it to a template.
In this assignment we will create and process a Heap of Customer objects. You are encouraged to reuse as much code as possible from previous assignments/labs.
The assignment consists of the following classes/files:
Customer.cpp (incomplete)
Customer.h (incomplete)
Heap.h (template, incomplete)
main.cpp (incomplete)
Project: 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 customer’s total mileage in the past year
B is the customer’s number of years in the flier program
C is the sequence number representing the customer’s arrival position when the flight was booked (the first customer’s sequence number is 1, second in the file is 2, and so on).
Two or more customers could have the same priority number. For instance, Robert Hill and Tom Martin have the same priority number:
Robert Hill’s priority number: 53000 / 1000 + 5 – 1 = 57
Tom Martin’s priority number: 56000/1000 + 5 – 4 = 57.
Customers with the same priority number must be served on a first come first serve basis, therefore build the heap based on a unique serial number determined using the following formula:
serial number = priority * 100 + (100 – C).
In the above example:
Robert Hill’s serial number is: 57 * 100 + (100 – 1) = 5799
Tom Martin’s serial number is: 57 * 100 + (100 – 4) = 5796
Given a file with overbooked customers, write a program that reads the file and determines each customer’s priority number, serial number, and prints a list of waiting customers in priority sequence, including the total number of customers served/rejected. There are two types of lines in the input file: line that begins with ‘A’ or ‘S’:
the letter ‘A’ represents the arrival of a new customer and it is followed by:
the number of years in the frequent flier program,
total mileage in the past year, and the
name of the customer (see below).
A 5 53000 Robert Hill // insert into the heap
A 3 89000 Amanda Trapp // insert into the heap
A 3 90000 Jonathan Nguyen // insert into the heap
S //delete from the heap and print
A 5 56000 Tom Martin // insert into the heap
The letter ‘S’ stands for “Serve” and indicates that the next customer from the waiting list will be served (in priority sequence).
Finally, display the overbooked customers that did not get a plain ticket. Example:
Input file name: overbooked_2.txt
==== ======= =============
Year Mileage Name
==== ======= =============
3 89000 Amanda Trapp
2 65000 Vincent Gonzales
==== ======= =============
Served overbooked customers: 2
==== ======= =============
Year Mileage Name
==== ======= =============
2 65000 Vladimir Johnson
5 53000 Robert Hill
4 42000 Steve Chu
3 34000 Paula Hung
==== ======= =============
Rejected overbooked customers: 5
Economic Debate- Progressive Income Tax For this Economic Debate, we are going to discuss the…
TOPIC: Going Global Discussion Thread 1 (initial post due Wednesday for full credit) Please note:…
Assignment Topic This week will culminate in the creation of a narrated PowerPoint to create…
The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted…
you need to post your 2-page information flier to share with your Final Project Group.…
discussion: Discuss the methods used at your company to measure and ensure quality products and…