PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Rippling

Design a delivery cost system

Last updated: Jun 15, 2026

Quick Overview

A Rippling software-engineer system-design screen: build an object-oriented, in-memory delivery cost system that registers drivers with hourly rates, records deliveries, and reports total cost, paid/unpaid amounts via an idempotent payUpTo cutoff, and the max number of drivers simultaneously delivering in the last 24 hours. It tests time-interval modeling, exact monetary arithmetic, sweep-line concurrency, idempotency, time-zone handling, and thread-safe dashboard reads.

  • medium
  • Rippling
  • System Design
  • Software Engineer

Design a delivery cost system

Company: Rippling

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

##### Question Design an object-oriented, in-memory **Delivery Cost System** for a food-delivery company. Drivers register with an hourly rate, deliveries are recorded as they complete, and the system reports cost and payment metrics for a live dashboard. Implement the following: 1. **`registerDriver(driverId, hourlyRate)`** — Add or update (upsert) a driver and their hourly rate. Drivers may have different rates. Decide whether a rate change should affect already-recorded deliveries. 2. **`recordDelivery(driverId, startTime, endTime)`** — Record one completed delivery. Cost accrues as `hourlyRate(driverId) x duration`. Deliveries are recorded immediately after completion and last no more than 3 hours. A single driver may have overlapping deliveries, and each is paid independently. Define interval semantics (inclusive/exclusive endpoints), how partial hours are prorated, and the time representation (require at least one-second precision). 3. **`getTotalCost()`** — Return the aggregated cost of all recorded deliveries across all drivers. This drives a live dashboard, so it should be cheap to call. 4. **`payUpTo(timestamp)`** — Mark all accrued cost up to the given timestamp as paid. A delivery that straddles the timestamp should have only the portion up to the timestamp counted as paid. Repeated or earlier calls must be idempotent. 5. **`getTotalUnpaid()`** — Return the remaining unpaid amount. 6. **`maxSimultaneousDriversInPast24Hours()`** — Return the maximum number of drivers that were simultaneously on a delivery at any instant within the last 24 hours. Discuss your class design, core data structures, method signatures, numeric precision (avoiding floating-point money errors), rounding, time-zone handling, thread-safety for a concurrent dashboard, idempotency, and the time/space complexity of each operation.

Quick Answer: A Rippling software-engineer system-design screen: build an object-oriented, in-memory delivery cost system that registers drivers with hourly rates, records deliveries, and reports total cost, paid/unpaid amounts via an idempotent payUpTo cutoff, and the max number of drivers simultaneously delivering in the last 24 hours. It tests time-interval modeling, exact monetary arithmetic, sweep-line concurrency, idempotency, time-zone handling, and thread-safe dashboard reads.

Related Interview Questions

  • Design a personalized news aggregator - Rippling (medium)
  • Design a Scalable News Feed - Rippling (medium)
  • Design Scalable Expense Violation Processing - Rippling (hard)
  • Scale a rules engine for high traffic - Rippling (medium)
  • Design several large-scale systems - Rippling (hard)
Rippling logo
Rippling
Jul 31, 2025, 12:00 AM
Software Engineer
Technical Screen
System Design
86
0

Design an object-oriented, in-memory Delivery Cost System for a food-delivery company.

Drivers register with an hourly rate, completed deliveries are recorded as they finish, and the system reports cost and payment metrics for a live dashboard. Implement the API below, then walk through your design decisions.

Context & assumptions

  • Everything lives in memory — no database is required for the core design (though you may discuss persistence as an extension).
  • Drivers may have different hourly rates , and a rate can be updated over time.
  • A single driver may run overlapping deliveries , and each delivery is paid independently.
  • Each delivery lasts no more than 3 hours and is recorded immediately after it completes.
  • Time must support at least one-second precision .

API to implement

  1. registerDriver(driverId, hourlyRate) — Add or update (upsert) a driver and their hourly rate. Decide whether changing a rate should affect already-recorded deliveries , and justify your choice.
  2. recordDelivery(driverId, startTime, endTime) — Record one completed delivery. Cost accrues as hourlyRate(driverId) × duration . When defining this method, specify:
    • Interval semantics — are endpoints inclusive or exclusive (e.g. [start, end) )?
    • Proration — how partial hours are handled.
    • Time representation — the type/units used to store an instant (one-second precision or finer).
  3. getTotalCost() — Return the aggregated cost of all recorded deliveries across all drivers. This powers a live dashboard, so it should be cheap to call .
  4. payUpTo(timestamp) — Mark all accrued cost up to timestamp as paid. A delivery that straddles the timestamp counts only the portion up to the timestamp as paid. Repeated calls, or calls with an earlier timestamp, must be idempotent .
  5. getTotalUnpaid() — Return the remaining unpaid amount.
  6. maxSimultaneousDriversInPast24Hours() — Return the maximum number of distinct drivers simultaneously on a delivery at any instant within the last 24 hours.

What to discuss

Cover the following as part of your design:

  • Class design & core data structures , and the method signatures you'd expose.
  • Numeric precision — how you avoid floating-point money errors, plus rounding policy.
  • Time-zone handling .
  • Thread-safety for a concurrent dashboard (simultaneous reads and writes).
  • Idempotency of payUpTo .
  • The time and space complexity of each operation.

Solution

Show

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Rippling•More Software Engineer•Rippling Software Engineer•Rippling System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.