Design the software for a supermarket checkout system.
A grocery store has multiple checkout lanes operated by cashiers, and the design should also be extensible to self-checkout. Customers bring items to a register, where the cashier scans products and the system computes the final total.
The system should support:
-
product lookup by barcode or PLU code
-
unit-based and weight-based items
-
quantities for the same item
-
taxes, discounts, promotions, and coupons
-
a running subtotal while items are scanned
-
voiding an item before payment
-
multiple payment methods such as cash and card
-
receipt generation
-
opening and closing a register session for a cashier
Discuss:
-
the core objects/classes and their responsibilities
-
the main APIs or service boundaries
-
the checkout session lifecycle and state transitions
-
how pricing and promotions should be modeled cleanly
-
error handling and data consistency concerns
-
how to extend the design later for loyalty programs, returns, and split payments