Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hey guys need help on a c++ program An airline has an algorithm to determine the priority of passengers who are wait-listed for a flight.

hey guys need help on a c++ program

An airline has an algorithm to determine the priority of passengers who are wait-listed for a flight. It calculates a priority key based upon (1) frequent flyer status, (2) price paid for the ticket and (3) arrival time at the gate. The lower the key value, the higher placed the passenger is in the queue. The calculation is as follows:

- If frequent flyer status is NONE, add 40 to priority key. If frequent flyer status is SLVR, add 30 to priority key. If frequent flyer status is GOLD, add 20 to priority key. If frequent flyer status is PLAT, do not add anything to priority key.

- If price paid for the ticket is $500 or more, do not add anything to the priority key. Otherwise, points are accumulated for every drop in price. Each price range is $49. For every drop between $1 and $49 dollars, add 5 to the priority key. For example, if the ticket price was $310, add 20 points to the priority key.

- The gate is considered to be open 1 hour prior to the flight. If the passenger is 60 minutes early, no points are added. For each minute closer to the flight time, add 1 point to the priority key.

Example:

#1 - A GOLD passenger who paid $415 for his ticket arrives 40 minutes prior to departure.

#2 A SLVR passenger who paid $525 for his ticket arrives 50 minutes prior to departure.

Passenger #1: The priority key value = 20 +10 + 20 = 50

Passenger #2: The priority key value = 30 + 0 + 10 = 40

Passenger #2 has priority ahead of Passenger #1.

In the event 2 passengers are assigned the same key value, they are prioritized in FIFO order.

Create a priority queue using a do-it-yourself doubly linked list (do not use the queue STL). You may treat it as either sorted or unsorted as you choose. However, document your choice at the beginning of the program. Provide for user input of passenger last name, frequent flyer status, price paid and number of minutes prior to departure time arrival.

You may use the following table for the input data or try it with your own data. After all of the passengers have been placed in the queue, remove them in priority sequence and print the associated information used in the determination.

Passenger Last Name

Frequent Flyer Status

Price Paid

Minutes Prior to Departure

Jones

GOLD

$437

30

Smith

PLAT

$385

38

Lee

NONE

$600

58

Harris

SLVR

$486

45

White

GOLD

$451

60

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago