Sanjaay Gowda T S
McDonald's Corporation practice

ORIGINAL COMPANY-CONTEXT PRACTICE

Price a synthetic restaurant order deterministically

Software engineeringMediumConcept

Original practice scenario: A restaurant-order simulator supports meal bundles, ingredient modifiers and location-specific prices. How should its pricing function remain testable?

Written for independent practice using company context; this is not a verified question from a company interview.

A REASONED APPROACH

Model answer.

Treat pricing as a deterministic transformation of a versioned menu and explicit order. Display names and mutable current prices should not determine historical order totals.

Work through it

  1. Represent items, bundles and modifiers with stable identifiers, validate allowed combinations and retain the menu version used for the quote.
  2. Calculate amounts using exact minor units and declared rounding rules, separating discounts, tax assumptions and fees in a transparent breakdown.
  3. Test repeated modifiers, unavailable items, bundle substitutions, zero quantities and price changes between quote and confirmation; require explicit requoting when necessary.

Tradeoffs to discuss

  • Snapshotting prices makes receipts reproducible but requires an expiration policy for unconfirmed quotes and clear handling of menu changes.

Common pitfalls

  • Do not silently substitute an item or modifier with a different price.
  • The exercise's simplified tax rules should remain explicit fictional inputs.

KEEP PRACTISING

Related questions.

Keep learning beyond the interview.

Explore the Learning Hub