# Write a C program called reservations.c that simulates some

Write a C program called reservations.c that simulates some people trying to reserve seats at a restaurant for dinner. The program MUST work as follows:

• The restaurant takes reservations anywhere from 4pm until 9pm. That means … someone can phone in and ask to reserve a table for a certain number of people starting at some specific time in the range of 4pm until 9pm. The people are allowed to stay past 9pm, but no more reservations can be made after 9pm. • The restaurant can seat at most 80 people at any time, on any day of the week. Reservations may be made at 15-minute intervals starting at 4pm. Hence, 4:00pm, 4:15pm, 4:30pm, 4:45pm, 5:00pm, 5:15pm, …., 8:45pm, 9:00pm. • The program MUST keep track of reservations by using a two dimensional array to indicate the number of patrons in the restaurant at any given timeslot. • The program must attempt to make 100 random (must be unique each time you run) reservations by choosing o A random day of the week o A random timeslot (i.e., there are 21 options from 4pm-9pm) o A random size (i.e., number of people) for that reservation which can be at most 40 • For each attempted reservation, you should show (nicely on he terminal window) the number of people for the reservation, the day of the week and the start time of the reservation. • If the reservation is able to be made, it should indicate that the reservation was accepted, otherwise it should indicate that it was denied. • In order to accept a reservation … we need to estimate the length of stay for each reservation. Assume the following: o If the reservation is for 2 people, the estimate length of stay is 60 minutes. o If the reservation is between 3-7 people, the estimate is for 75 minutes. o If the reservation is between 8-11 people, the estimate is for 105 minutes. o Otherwise the estimate should be for 120 minutes. • The program should accept the reservation if the restaurant can hold that many people for the duration of the estimated length of stay. For example, if a 5pm reservation for 4 people is made, you need to ensure that there are at most 76 people (i.e., restaurant capacity minus the reservation size) currently reserved for the following timeslots: 5:00pm, 5:15pm, 5:30pm, 5:45pm and 6:00pm. If any are over the value of 76, then the reservation should not be made, it should be denied.
• After each random reservation is made (or denied), the program should display a nicelyformatted table showing the current reservation counts for each timeslot. This displaying must be done by means of a function that takes the 2D array as a parameter. The table should look as show below on the left. Note that it indicates the number of people currently reserved for that timeslot. You can see that on Tuesday, a reservation for 12 people has been reserved starting at 5:30pm and they are estimated to be gone by 7:30pm. The smaller group of 2 people on Sunday at 5:00pm are estimated to only be there for 1 hour. The image on the right shows the results after quite a few reservations have been made … many of them overlapping.

Members