← 返回 rippling 的题目列表Food Delivery Dashboard with Driver Cost and Payment Tracking
类型:online_judge
rippling
Please build a food delivery dashboard system with the following functionalities:
Function Definitions
add_driver(driver_id, hourly_rate): Add a driver with a specific hourly rate.
record_delivery(driver_id, start_time, end_time): Record a completed delivery with the assigned driver and the delivery's start and end times.
get_total_cost(): Return the total cost of all deliveries so far.
Advanced Functionality
pay_up_to(pay_time): Calculate and mark as paid all costs up to a certain time.
get_total_cost_unpaid(): Return the total cost of all unpaid deliveries.
Notes
Time is represented as a 24-hour format string, e.g., '14:30'. Ensure that all input parameters are valid and consider the accumulation of costs for different drivers.
Provide operational examples and verify their correctness.
Example
Input
add_driver(1,10)
record_delivery(1,'13:00','15:00')
get_total_cost()
pay_up_to('15:00')
get_total_cost_unpaid()