Preparing your design workspace

Loading the problem and your saved attempt…

Design and Implement Hotel Room Pricing

Model and implement a stay quote that prices each night by room type and season, adds per-night add-ons, and grows to fixed fees and other pricing rules.

Design and implement the pricing part of a hotel booking system. A guest asks for the price of one stay: a room type, a check-in date, a number of nights, and any add-ons they want. Each room type has a base nightly price, each season changes the nightly rate, and add-ons cost extra.

For this exercise, assume: - The hotel must be able to add new room types, seasons, and add-ons later without changing how a quote is produced. - One quote covers one stay of 1 to 30 nights in one room. Each night is priced on its own date, so a stay can cross from one season into another. - A night's room charge is the room type's base nightly price times the multiplier of the season that contains that night's date. A date outside every season uses the standard multiplier of 1.0. Seasons never overlap. - Each add-on has a fixed price per night that seasons do not change, and it is charged for every night of the stay. A request may not list the same add-on twice. - Money is kept in whole cents. Multipliers are kept in basis points, where 10,000 means 1.0. Each night's room charge is rounded half up to a whole cent. The stay total is the sum of the nightly room charges plus the add-on charges. Besides the total, a quote shows each night's room charge and each add-on's charge. - The pricing data does not change while one quote is being computed. An unknown room type or add-on, a repeated add-on, or a night count outside 1 to 30 is rejected with a clear error before any price is computed.

Availability, booking, payment, taxes, cancellation, currency conversion, storage, and user interface are out of scope. After the design, implement the stay-price calculation in code or precise pseudocode.