I am using Python. How would I go about writing the loop for this code? the code in general is a little confusing because I do not understand how I can incorporate the math in. Please put comments in...


I am using Python. How would I go about writing the loop for this code? the code in general is a little confusing<br>because I do not understand how I can incorporate the math in.<br>Please put comments in your program explaining your logic and documenting the program.<br>(1) Ask for the number of guests. Users will enter a negative number when guests leave and a<br>positive number when a group arrives.<br>(2) Your program needs to seat the given number of guests if possible and, if not they have to<br>wait to seated as soon as possible.<br>(3) This is a fair system so groups will be seated in the order in which they arrive. In other<br>words, if a group of our arrives and there are only three seats open, they have to wait. If another<br>group of two arrives immediately after the group of 4, they have to wait until enough seats open<br>that the group of four can sit and then the group of two can sit. No queue jumping here!<br>(4) Please note that the staff can get quite busy and sometimes may overestimate the number of<br>people leaving! There can never be less than 0 people seated<br>(5) After each entry for number of guests, print the new occupied seat total.<br>(6) The user will enter 0 guests to end the program.<br>Sample Execution<br>RESTAURANT SYSTEM<br>Number of Seats: 24<br>Number of Seats Filled: 12<br>Number of Guests:4<br>Numbar of Patrons Seated = 16<br>Number of Guests: 12<br>Number of Patrons Seated- 16<br>Number of Guests: -4<br>Mumber of Patrons Seated = 24<br>Mumber of Guests: 0<br>

Extracted text: I am using Python. How would I go about writing the loop for this code? the code in general is a little confusing because I do not understand how I can incorporate the math in. Please put comments in your program explaining your logic and documenting the program. (1) Ask for the number of guests. Users will enter a negative number when guests leave and a positive number when a group arrives. (2) Your program needs to seat the given number of guests if possible and, if not they have to wait to seated as soon as possible. (3) This is a fair system so groups will be seated in the order in which they arrive. In other words, if a group of our arrives and there are only three seats open, they have to wait. If another group of two arrives immediately after the group of 4, they have to wait until enough seats open that the group of four can sit and then the group of two can sit. No queue jumping here! (4) Please note that the staff can get quite busy and sometimes may overestimate the number of people leaving! There can never be less than 0 people seated (5) After each entry for number of guests, print the new occupied seat total. (6) The user will enter 0 guests to end the program. Sample Execution RESTAURANT SYSTEM Number of Seats: 24 Number of Seats Filled: 12 Number of Guests:4 Numbar of Patrons Seated = 16 Number of Guests: 12 Number of Patrons Seated- 16 Number of Guests: -4 Mumber of Patrons Seated = 24 Mumber of Guests: 0

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here