AlgoViz

Design a car rental

hard 90 min

Design the classes of a rental company: search by period, booking a size, handing out a car, upgrades, late returns and bills.

Watch lesson4:48

Where it shows up

The same pattern appears across everyday software.

  • PostgreSQL: range types and exclusion constraints

    `EXCLUDE USING GIST (room WITH =, during WITH &&)` makes the database refuse two overlapping ranges for one room. The manual's example is a room reservation.

  • PostgreSQL: serializable transactions

    The project's wiki shows write skew on small examples and how serializable isolation detects it. The two clicks on this page are one of these cases.

  • iCalendar, RFC 5545

    The end of an event, `DTEND`, is the non-inclusive end. Calendars all over the world exchange half-open periods.

  • ThreeTen-Extra: Interval

    A Java class for an interval between two instants, the start included and the end excluded, with methods such as `overlaps` and `abuts`.

  • Odoo Rental

    Its settings have a default padding time, the minimum between two rentals, and default delay costs for late returns. Turnaround and late fee of this page.

  • GBFS, the bikeshare feed specification

    Stations publish how many vehicles of each type are available, as counts and not as plates. A reserved vehicle that is not used in time must become free again.

  • Stripe: place a hold

    With `capture_method` set to manual an amount is authorised and captured later. If it is not captured before the authorisation ends, the funds are released.

  • Google OR-Tools: minimum cost flow

    Solves moving units from places with a supply to places with a demand at the lowest cost, which is the problem of bringing one-way cars back.