Bus Stop Queue

Write a program using a linked list to simulate a waiting line at a bus stop. Each input record contains four items: code, date (optional), time, and an integer. The code is

either 'B', in which case the record represents e arrival of a bus at the bus stop, or 'P'. in which case the record represents the arrival of a group of people at the bus

stop at the indicated time. The integer represents the number of people for which the bus has room in the case of a 'B' code.

The people are assumed to form a single line, entering the line at the rear and leaving the line at the front to board the bus. If a bus arrives with room for n people, the first n people on line board the bus and the bus does not wait for more people to arrive. The input records are to be in order of arrival times. Each time that a 'B' record is read, print the following message:

TIME xxx. BUS ARRIVES, PICKS UP yyy PEOPLE. zzz REMAIN.

Each time a 'P' record is read, print the following message:

TIME xxxx. yyy PEOPLE ARRIVE, zzz PEOPLE NOW ON LINE.

Use the following as input data (partial records), and add more data of your own.

P 0900 15

P 0910 15

B 0915 20

P 0920 25

B 0930 50

P 0945 20

P 0955 25

B 1005 30

B 1015 10

P 1030 25

B 1035 30

B 1045 30

...

...