Skip to main content
PreparationZone Logo
PrepZone

Design Hotel Booking

Room inventory, date ranges, and overlapping reservations.

Pass checkpoint below

Why this matters

  • Date-range overlap is a classic algorithm + OOP combo question.
  • Room inventory contention appears in hotel, flight, and meeting scheduler problems.
  • Cancellation and modification rules test whether your model is flexible.
  • Strong answers separate search, hold, confirm, and cancel as distinct operations.
BookingService
Resourceroom, seat, table
TimeSlotstart, end, capacity
Reservationstatus, userId
Typical CampusOS booking: resource, slot, reservation, user.

CampusOS context

CampusOS is the fictional smart-campus platform used across this track. Treat this module as a real product slice:

Context

  • Belongs to CampusOS — same naming and design vocabulary as parking, library, and booking modules
  • Scope is one JVM — persistence is in-memory or behind a repository interface
  • Goal is a class diagram + core Java that an interviewer can follow in 35–45 minutes
  • Extension paragraph at the end links to System Design when scale exceeds one process

Requirements snapshot

Functional requirements

  • Search hotels by city, check-in, check-out, and guest count
  • Room types (single, double, suite) with different capacity and price
  • Reserve room for date range; prevent double booking same room
  • Modify dates or cancel according to policy
  • Guest profile stores booking history
  • Admin manages room inventory and pricing

Non-functional requirements

  • Efficient availability query for date ranges
  • Consistent read of inventory during concurrent reservations
  • Cancellation policy enforced in domain layer

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 6 sections

  • Overview
  • Requirements
  • Room types
  • Date overlap
  • Cancellation
  • CampusOS extension

Test yourself

Answer these before moving on — recall is what makes it stick.