You are to write a program to simulate the landing of airplanes at a small airport. The airport has one runway. Your main read loop should repeat the following tasks: get a request, put the plane into a queue; allow one plane to land if the runway is available (clear). A new request is read at the beginning of each "time cycle." For your purposes, a time cycle will be equivalent to one trip through your main read loop. Planes requesting clearance to land are put in a normal queue. Planes that have some kind of problem and must land immediately are put in a priority queue. A plane is allowed to land every other time cycle. When a plane lands, its flight information is printed out. When all the data has been processed, the contents of the two queues are printed out with appropriate headers.

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

This is a queue code that has to be written in c++. I am having some troubles writing it. Please help

NORMAL
82DAYTON
COLUMBUS190
OUTPUT
The first part of your output should consist of a series of messages. Each time a plane lands, a
message
should be printed along with all the flight information and whether the landing was an
emergency or not. Each time a plane is added to a queue, a message should be printed along with
all the flight information and which queue the plane was added to. Finally, every time through
the main read loop, you should print a message stating what "time cycle" it is.
The second part of your output should consist of a list of all flights still in the two queues at the
end of the simulation.
DATA STRUCTURES
You will need two array-based queues one for normal flights and one for emergencies. Queues
should be manipulated directly-functions should be used to handle them. Do not access
variables globally. Do not use pointers, standard libraries, or classes.
Make the runway variable an enumerated user-defined data type, i.e., let it have (BUSY,
CLEAR) as its possible values. All flight information should be set up in a record. Use only
named data types.
Transcribed Image Text:NORMAL 82DAYTON COLUMBUS190 OUTPUT The first part of your output should consist of a series of messages. Each time a plane lands, a message should be printed along with all the flight information and whether the landing was an emergency or not. Each time a plane is added to a queue, a message should be printed along with all the flight information and which queue the plane was added to. Finally, every time through the main read loop, you should print a message stating what "time cycle" it is. The second part of your output should consist of a list of all flights still in the two queues at the end of the simulation. DATA STRUCTURES You will need two array-based queues one for normal flights and one for emergencies. Queues should be manipulated directly-functions should be used to handle them. Do not access variables globally. Do not use pointers, standard libraries, or classes. Make the runway variable an enumerated user-defined data type, i.e., let it have (BUSY, CLEAR) as its possible values. All flight information should be set up in a record. Use only named data types.
You are to write a program to simulate the landing of airplanes at a small airport. The airport has
one runway. Your main read loop should repeat the following tasks: get a request, put the plane
into a queue; allow one plane to land if the runway is available (clear).
A new request is read at the beginning of each "time cycle." For your purposes, a time cycle will
be equivalent to one trip through your main read loop. Planes requesting clearance to land are put
in a normal queue. Planes that have some kind of problem and must land immediately are put in
a priority queue.
A plane is allowed to land every other time cycle. When a plane lands, its flight information is
printed out.
When all the data has been processed, the contents of the two queues are printed out with
appropriate headers.
МЕТНOD
The top level of this program should look like:
set queues to empty
set runway to clear
set time to zero
read
loop until no more data
increment time
check the request; then add to the proper queue
check the runway; if clear then land a plane & set runway
to busy else set runway to clear
read
end loop
traverse & print contents of queues
Transcribed Image Text:You are to write a program to simulate the landing of airplanes at a small airport. The airport has one runway. Your main read loop should repeat the following tasks: get a request, put the plane into a queue; allow one plane to land if the runway is available (clear). A new request is read at the beginning of each "time cycle." For your purposes, a time cycle will be equivalent to one trip through your main read loop. Planes requesting clearance to land are put in a normal queue. Planes that have some kind of problem and must land immediately are put in a priority queue. A plane is allowed to land every other time cycle. When a plane lands, its flight information is printed out. When all the data has been processed, the contents of the two queues are printed out with appropriate headers. МЕТНOD The top level of this program should look like: set queues to empty set runway to clear set time to zero read loop until no more data increment time check the request; then add to the proper queue check the runway; if clear then land a plane & set runway to busy else set runway to clear read end loop traverse & print contents of queues
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 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