Question
#### Q2d (10 marks) Python code The restaurant has decided to allow larger bookings. This is implemented by allowing multiple bookings under a single name,
#### Q2d (10 marks) Python code
The restaurant has decided to allow larger bookings. This is implemented by allowing multiple bookings under a single name, each booking being for a single table of up to four patrons. Tables are configured such that two tables seats 5-8 patrons, three tables seats 9-12, and so on. If Howson was to book for a party of 6, they would make two bookings. Each additional booking made would have the next available reservation ID after the one provided, so if Howson was booked under reservation ID 7, there would be a booking for reservation ID 7 and a booking for reservation ID 8, if 8 was available. If Linson has already booked under reservation ID 8, then Howson would have 7 and 9. It can be assumed that the initial reservation ID is available. When large bookings are made, patrons are not allowed to book a particular table number.
The code below extends the *BookingsExtended* class. Amend the *add_large_booking* method to enable a booking of any party size to be added, with one table being booked per four party members. Any remaining party members would have a final table booked.
You can use the tests below to help check if your code is working. NOTE that failing the tests is a clear indication you code is faulty, but passing the tests is NOT a guarantee it is correct. Your tutor may run additional tests.
class BookingsLargerGroups(BookingsExtended): def add_large_booking(self, reservation_ID: int, name: str, party_size) -> None: pass #Write your code here #Tests start here TestQueue = BookingsLargerGroups() TestQueue.add_large_booking(8,'Linson',4) TestQueue.add_large_booking(7,'Howson',6) print(TestQueue.as_dict())
#Run this code to ensure code works %run -i m269_util test_table = [ ['One small one large',{8: ('Linson', 0, 0), 7: ('Howson', 0, 0), 9: ('Howson', 0, 0)}], ]
test(TestQueue.as_dict, test_table)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started