3) Suppose an airline company has hired you to write a program for choosing the passengers who should leave an overbooked flight. That means the airline has booked too many passengers hoping some of them would not show up on time, but passengers are on board and the aircraft doesn't have enough seats available for all these passengers. Your program chooses the passenger who must leave the flight. Passengers will be ranked based on the fare they have paid for booking (a double number called fare), and their number of loyalty points (an integer number called points). Fare and points are equally important, that means, in order to decide the position of each passenger in the list, fare and points each have 50% importance. A Person with minimum priority (combination of fare and points) will leave the flight. You need to define a class called Passenger with these member variables: • passenger's name • fare • points. Passenger class must have 3 accessors, 3 mutators, a constructor with three parameters, an input function to read the passenger's info, and an output function to display the passenger's info. Also, you need a class called Flight, in which you store a string for the flight number and the information of all passengers on any flight (a dynamic array of Passenger objects). In the Flight class, you need a function called insert (for adding a passenger), display (to display the name, fare, and points of all passengers in ascending order), and leave (for choosing the passenger who leaves the aircraft and removing his/her info from the passenger list). It is important that the display function displays passengers in ascending order. So, the person on the top of the list is the one who will leave first, not the passenger who booked the flight first and was added to the list of passengers before others. Finally, write a main function that tests your classes and displays the following output. you need to add 5 passengers (not necessarily in the order shown below), display the list of passengers (you see the list is in ascending order), remove the first passenger, display the list again, remove another passenger, and display the list again. This type of list of passengers is called a Priority Queue. This is not the same as Queue you learned in this course. Regular Queues are first in first out (FIFO). But this list of passengers is "paid less first out". Passengers who paid less fare (purchased their ticket on sale) or passengers who fly less frequently are considered as passengers with lower priority and must leave before others. Save the program as Q3.cpp

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
3) Suppose an airline company has hired you to write a program for choosing the passengers
who should leave an overbooked flight. That means the airline has booked too many
passengers hoping some of them would not show up on time, but passengers are on board and
the aircraft doesn't have enough seats available for all these passengers. Your program chooses
the passenger who must leave the flight.
Passengers will be ranked based on the fare they have paid for booking (a double number
called fare), and their number of loyalty points (an integer number called points). Fare and
points are equally important, that means, in order to decide the position of each passenger in
the list, fare and points each have 50% importance. A Person with minimum priority
(combination of fare and points) will leave the flight.
You need to define a class called Passenger with these member variables:
passenger's name
• fare
points.
Passenger class must have 3 accessors, 3 mutators, a constructor with three parameters, an
input function to read the passenger's info, and an output function to display the passenger's
info.
Also, you need a class called Flight, in which you store a string for the flight number and the
information of all passengers on any flight (a dynamic array of Passenger objects). In the Flight
class, you need a function called insert (for adding a passenger), display (to display the name,
fare, and points of all passengers in ascending order), and leave (for choosing the passenger
who leaves the aircraft and removing his/her info from the passenger list). It is important that
the display function displays passengers in ascending order. So, the person on the top of the
list is the one who will leave first, not the passenger who booked the flight first and was added
to the list of passengers before others.
Finally, write a main function that tests your classes and displays the following output. you
need to add 5 passengers (not necessarily in the order shown below), display the list of
passengers (you see the list is in ascending order), remove the first passenger, display the list
again, remove another passenger, and display the list again.
This type of list of passengers is called a Priority Queue. This is not the same as Queue you
learned in this course. Regular Queues are first in first out (FIFO). But this list of passengers is
"paid less first out". Passengers who paid less fare (purchased their ticket on sale) or
passengers who fly less frequently are considered as passengers with lower priority and must
leave before others.
Save the program as Q3.cpp
Transcribed Image Text:3) Suppose an airline company has hired you to write a program for choosing the passengers who should leave an overbooked flight. That means the airline has booked too many passengers hoping some of them would not show up on time, but passengers are on board and the aircraft doesn't have enough seats available for all these passengers. Your program chooses the passenger who must leave the flight. Passengers will be ranked based on the fare they have paid for booking (a double number called fare), and their number of loyalty points (an integer number called points). Fare and points are equally important, that means, in order to decide the position of each passenger in the list, fare and points each have 50% importance. A Person with minimum priority (combination of fare and points) will leave the flight. You need to define a class called Passenger with these member variables: passenger's name • fare points. Passenger class must have 3 accessors, 3 mutators, a constructor with three parameters, an input function to read the passenger's info, and an output function to display the passenger's info. Also, you need a class called Flight, in which you store a string for the flight number and the information of all passengers on any flight (a dynamic array of Passenger objects). In the Flight class, you need a function called insert (for adding a passenger), display (to display the name, fare, and points of all passengers in ascending order), and leave (for choosing the passenger who leaves the aircraft and removing his/her info from the passenger list). It is important that the display function displays passengers in ascending order. So, the person on the top of the list is the one who will leave first, not the passenger who booked the flight first and was added to the list of passengers before others. Finally, write a main function that tests your classes and displays the following output. you need to add 5 passengers (not necessarily in the order shown below), display the list of passengers (you see the list is in ascending order), remove the first passenger, display the list again, remove another passenger, and display the list again. This type of list of passengers is called a Priority Queue. This is not the same as Queue you learned in this course. Regular Queues are first in first out (FIFO). But this list of passengers is "paid less first out". Passengers who paid less fare (purchased their ticket on sale) or passengers who fly less frequently are considered as passengers with lower priority and must leave before others. Save the program as Q3.cpp
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY