Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PART A ) Please use java and priority queue using heaps We would like to implement boarding of passengers in an airplane. Passengers arrive belonging

PART A ) Please use java and priority queue using heaps

We would like to implement boarding of passengers in an airplane. Passengers arrive belonging to different classes in the cabins, can be elderly, can have infants with them, or belong to the armed services. Each of the passenger is provided a priority depending on the conditions described. A passenger with a higher priority (indicated by a small number) is boarded before passengers with lower priority, ignoring the order in which they arrive; hence using a normal queue would not be sufficient. Using a priority queue to keep track of the order of boarding is useful in this scenario.

Construct the program using the following guidelines:

Create a Java Class for passengers. The data fields in the Class should include First Name, Last Name, Date of Birth, Boarding category and Priority.

Simulate incoming passengers with varied degree of boarding class and priority. Higher boarding class should be reflected by lower priority. Range priorities from 1 to 20. For example, Traveling with infant is priority 1, Elderly is priority 5, Armed Services is priority 10, First Class is priority 15 and Economy class is priority 20.

Add the passengers to the priority queue when they arrive based on the priority.

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_2

Step: 3

blur-text-image_3

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

What is Working Capital ? Explain its types.

Answered: 1 week ago

Question

=+employee to take on the international assignment?

Answered: 1 week ago

Question

=+differences in home- and host-country costs of living?

Answered: 1 week ago