Design a delivery cost dashboard with payments
Company: Rippling
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Technical Screen
Design an object-oriented delivery cost dashboard service. Implement a class (or set of classes) that supports:
1) add_driver(driver_id: integer, usd_hourly_rate: float) — add a driver who is not yet in the system.
2) record_delivery(driver_id: integer, start_time, end_time) — record a completed delivery for an existing driver; deliveries are entered immediately after completion, no delivery exceeds 3 hours, and time precision must be at least one second. Drivers have individual hourly rates and can run multiple overlapping deliveries; each delivery is paid independently as duration_in_hours × driver_rate (e.g., $10.00/hr for 1h30m pays $15.
00).
3) get_total_cost() — return the aggregated cost of all recorded deliveries across all drivers (suitable for a live dashboard; exact formatting not required). Before coding, discuss and justify how you will store and represent time (e.g., Unix seconds, ISO-8601 strings, timezone handling) and any assumptions. Share design decisions, what you would do differently in production, and demonstrate good OOP practices. Extend the system with payment tracking:
4) pay_up_to(pay_time: integer, Unix time from epoch) — mark as paid all deliveries that ended at or before pay_time.
5) get_total_cost_unpaid() — return the total cost of all recorded deliveries that have not yet been paid. Inputs are valid; concurrency and thread-safety are out of scope.
Quick Answer: Design a delivery cost dashboard with payments evaluates requirements, scale assumptions, API/data design, architecture, trade-offs, failure modes, and rollout in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.