रेस्तरां आरक्षण
इस कार्य में, आपको एक रेस्तरां श्रृंखला की प्रबंधन प्रणाली डिज़ाइन करनी है। एक Python क्लास
Restaurant
बनानी है जिसमें दो मेथड्स होंगे - make_reservation
और order_food
। उसके बाद, आपको Restaurant
की बच्चा क्लास FastFoodRestaurant
डिज़ाइन करनी है जो make_reservation
मेथड को override करती है ताकि हमेशा We do not take reservations.
प्रिंट किया जाए।रेस्तरां में टेबलों की एक निश्चित संख्या होती है। हर आरक्षण 1 घंटे लंबा माना जाता है।
make_reservation
मेथड को यह संभालना चाहिए और अगर अनुरोधित समय के लिए कोई टेबल खाली नहीं है, तो No seats available
प्रिंट करना चाहिए। मेथड make_reservation
तीन पैरामीटर लेगा - व्यक्ति का नाम, टेबलों की संख्या, और दिनांक-समय yyyy-mm-dd-hh
प्रारूप में। अगर आरक्षण सफल होता है, तो मेथड Reservation made for <name> at <date>
प्रिंट करेगा।order_food
मेथड को ऑर्डर किए गए आइटमों का मनमाना संख्या में argument स्वीकार करना चाहिए और संदेश प्रिंट करना चाहिए Order with <item1>, <item2>, ..., <item_n> placed!
।इनपुट | आउटपुट |
restaurant = Restaurant('Dining Paradise', 5); restaurant.make_reservation('John', 2, '2023-10-24-19') | Reservation made for John at 2023-10-24-19 |
fast_food = FastFoodRestaurant('Burger World', 5); fast_food.make_reservation('John', 2, '2023-10-24-19'); fast_food.order_food('Burger', 'Soda') | We do not take reservations.
Order with Burger, Soda placed! |
restaurant = Restaurant('Dining Paradise', 1); restaurant.make_reservation('John', 1, '2023-10-24-19'); restaurant.make_reservation('Mary', 2, '2023-10-24-19') | Reservation made for John at 2023-10-24-19
No seats available |
ध्यान दें कि इस समस्या में वर्तमान समय प्रासंगिक नहीं है। मान लें कि सभी आरक्षण मान्य हैं।
Constraints
Time limit: 1 seconds
Memory limit: 512 MB
Output limit: 1 MB