Design a Movie Ticket Booking System
MediumReal World SystemsObserverFactorySingleton
Problem Statement
Design a movie ticket booking system (like BookMyShow or Fandango) that allows users to:
- Browse movies and showtimes
- Select seats from a seat map
- Book and cancel tickets
- Handle concurrent booking (prevent double-booking)
Design Requirements
Key Entities:
Movie— Title, genre, duration, ratingTheater— Screens, locationScreen— Physical screen with seating layoutShow— A movie at a theater at a specific timeSeat— Individual seat with row/column/type (Normal, Premium, VIP)Booking— Ties user, show, and seats togetherPayment— Handles payment processing
Key Behaviors:
searchShows(movie, date)→ list of showsgetSeatMap(showId)→ 2D grid of seatsbookSeats(showId, seatIds, userId)→ Booking or throws if unavailablecancelBooking(bookingId)→ releases seats
!Constraints
- A screen has 10–300 seats arranged in rows
- Seat types: Normal ($10), Premium ($15), VIP ($25)
- A booking can have 1–10 seats
- Seats must be locked during payment (max 10 min hold)
- Two users cannot book the same seat for the same show
- Cancellation is allowed up to 2 hours before show time
Output
Run your code to see output here.