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 o 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 Mumber of Seats: 24 Hunber of Seats Filled: 12 Number of Guests: 4 Number of Patrons Seated 16 Number of Guesta: 12 Mumber of Patrons Seated- 16 Number of Guests: -4 Munber of Patrons seated 24 Mumber of Guests: 0

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
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
Transcribed Image 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
Expert Solution
steps

Step by step

Solved in 2 steps

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