Rent the Machine Right
Your company owns exactly one mobile crane, and the rental desk's inbox is full of requests that fight over it. Each request names the dates it wants the crane and the price the customer will pay for the whole rental. Your job is the planner: pick the set of requests that never puts the crane in two places at once and brings in the most money — and report exactly which requests won.
Requirements
The starter contains a table named "Rental Request" — the in-memory request board your code works on. Keep its fields and keys exactly as shipped; the grading tests seed it and read it back:
"Request No."—Code[20], the primary key"Start Date"—Date, the day the customer picks the crane up"End Date"—Date, the day the customer returns it; the crane is occupied from"Start Date"up to but not including"End Date"Price—Decimal, what the customer pays if the request is accepted; all-or-nothing, never proratedSelected—Boolean, your output:trueon exactly the accepted requests
Create a codeunit named "Rental Planner" with one public procedure:
procedure MaximizeRevenue(var RentalRequest: Record "Rental Request"): DecimalRules:
- Two requests can both be accepted only when they never occupy the crane on the same day: one's
"End Date"must be on or before the other's"Start Date". A back-to-back handover is legal — a request may start on the very day another one ends.
Solve it with Pro
You’re reading the opening of the statement. Pro unlocks the whole problem:
- The full statement
- Starter code in the browser editor
- 14 grading tests, run on Business Central 28.5
- 3 hints
- The reference solution
Pro also opens all 92 Pro problems and lifts the daily limits on compile checks and submissions.
Already on Pro? Sign in