Question: C + + Please utilize NodeType structure throughout the program, create an enqueue using parameters code, time, numPeople, and create a dequeue using parameter numPeople.

C++
Please utilize NodeType structure throughout the program, create an enqueue using parameters code, time, numPeople, and create a dequeue using parameter numPeople. Please ensure the output of the program matches exactly like the sample output.
Write a program that simulates a waiting line at a bus stop using a queue data structure. Each input
record comprises three elements: code (B for bus arrival, P for people arrival), a time, and a
numPeople representing the number of people for buses. Buses pick up people in the order they arrive,
with each bus departing once it reaches its capacity. When a B record is processed, print: TIME xxx.
BUS ARRIVES, PICKS UP yyy PEOPLE. zzz REMAIN. When a P record is processed, print: TIME xxx. xxx
PEOPLE ARRIVE, xxx PEOPLE NOW IN LINE.
//input.txt
P 090015
P 091015
B 091520
P 092025
B 093050
P 094520
P 095525
B 100530
B 101510
P 103025
B 103530
B 104530
Here is the structure of BusStop and NodeType:
struct BusStop
{
char code;
int arrival_time;
int NumPeople;
};
struct NodeType
{
BusStop busStop;
NodeType* next;
};
Sample Output:
Time 0900.15 PEOPLE ARRIVE, 15 PEOPLE NOW IN LINE.
Time 0910.15 PEOPLE ARRIVE, 30 PEOPLE NOW IN LINE.
Time 0915. BUS ARRIVES, PICKS UP 20.10 REMAIN.
Time 0920.25 PEOPLE ARRIVE, 35 PEOPLE NOW IN LINE.
Time 0930. BUS ARRIVES, PICKS UP 50.0 REMAIN.
Time 0945.20 PEOPLE ARRIVE, 20 PEOPLE NOW IN LINE.
Time 0955.25 PEOPLE ARRIVE, 45 PEOPLE NOW IN LINE.
Time 1005. BUS ARRIVES, PICKS UP 30.15 REMAIN.
Time 1015. BUS ARRIVES, PICKS UP 10.5 REMAIN.
Time 1030.25 PEOPLE ARRIVE, 30 PEOPLE NOW IN LINE.
Time 1035. BUS ARRIVES, PICKS UP 30.0 REMAIN.
Bus stop records complete.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!