Design a Restaurant Management System

Hard
Real World SystemsObserverFactoryStateStrategy

Problem Statement

Design a restaurant management system that handles:

  • Table management (reservation, seating, clearing)
  • Menu management (items, categories, prices, availability)
  • Order management (placing, modifying, tracking status)
  • Kitchen workflow (order queue, item preparation)
  • Billing (generate bill, apply discounts, split bill)
  • Staff management (waiters, kitchen staff, manager)

Design Requirements

Key Entities:

  • Restaurant — Main system (Singleton)
  • Table — Physical table with status
  • MenuItem — Food/drink item with price and category
  • Order — A table's order with multiple OrderItems
  • OrderItem — A specific menu item with quantity
  • Bill — Final bill with tax, discounts
  • KitchenDisplay — Shows pending orders to kitchen (Observer)
  • Waiter, Chef — Staff with roles

Order Flow: SEATED → ORDER_PLACED → PREPARING → READY → SERVED → BILLED → CLEARED

Key Behaviors:

  • seatCustomers(tableId, partySize) → assigns table
  • placeOrder(tableId, items) → creates Order, notifies kitchen
  • markItemReady(orderId, itemId) → kitchen marks item done
  • generateBill(tableId) → calculates total with tax

!Constraints

- Restaurant has 5–50 tables of varying capacity (2, 4, 6, 8 seats) - Menu has up to 100 items across 5 categories - Multiple orders can be placed for the same table (e.g., refills, add-ons) - Tax is 10%, optional service charge is 18% - Support bill splitting by seat or equally - Order status updates notify kitchen display (Observer)
Output

Run your code to see output here.