Extensible cinema ticket pricing engine
I was asked this
No reports yet. Sign in to say where you were asked it.
An object-oriented design interview question asked in Amazon's technical phone screen, last asked May 2026. It tests object-oriented design and pricing.
Design the pricing engine for a cinema's tickets. A movie format (2D, 3D, IMAX…) sets a base price; the showtime (matinee, evening…) and the seat tier (standard, premium…) each apply a multiplier; add-ons (3D glasses, a recliner upgrade, a snack combo) add fixed amounts. The price is (base + add-ons) × showtime multiplier × seat multiplier. New formats, showtimes, tiers and add-ons must be addable without editing a big conditional.
Requirements
- Functional: quote a ticket from a format, showtime, seat tier and any add-ons; return the total and an itemized breakdown; reject unknown or incompatible options.
- Non-functional: exact money arithmetic, one stated rounding rule, and quotes that can be reproduced later after prices change.
Classes and operations
Unless you agree on a different design with the interviewer, assume:
-
Money(integer minor units and a currency) andMultiplier(a validated decimal). -
PricingConfig(versioned): base prices by format, multipliers by showtime and tier, add-on prices and which options they're allowed with. -
PricingEngine.quote(request, config) -> Quote—Quoteholds the line items, the total and the config version.
Example
config v7: IMAX base 15.00; evening × 1.20; premium × 1.50; recliner add-on 3.00
quote(IMAX, evening, premium, [recliner])
-> (15.00 + 3.00) × 1.20 × 1.50 = 32.40, config v7
Clarifying questions
- At which step is rounding applied, and which rounding mode?
- Can an add-on be limited to certain formats, showtimes or tiers?
- Must a quote issued yesterday reproduce exactly after a price change?
- Are taxes and discounts in scope?
What a strong answer covers
- Value objects for money and multipliers with invariants checked at construction; no binary floats.
- Price components (base, multiplier, add-on) as small policies looked up from config, not
if format == "IMAX"branches. - A fixed calculation order and rounding rule, applied once, documented and tested.
- Compatibility checks for add-ons, and errors for unknown options instead of silent defaults.
- Config versioning separated from the engine, with the version on every quote.
- Unit tests per component, property tests over combinations, and boundary values.
Follow-ups
- Coupons and taxes: where do they plug in without touching every component?
- Stop a new add-on from being sold with a seat it doesn't fit.
- An idempotent quote API: what does it return if the config changes mid-request?
Where it's asked
- Amazon · Technical phone screen · Last asked May 202660 min · Live coding in a shared editor that does not run code, plus Leadership Principles questions · No AI
What it tests
object-oriented design · pricing
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
