Got this question as part of Machine Coding Round to design a toll management system.
Requirement:
- There are multiple tolls across country and each toll has several booths
- A Vehicle can be issued 3 type of passes:
- Single Day Pass (Can be used only once)
- Return Pass (Can be used for return journey on same day)
- Seven Day Pass (Can be used as many number of times during 7 days duration)
- There are two type of vehicles - 2 wheeler and 4 wheeler
Assumptions
- Toll and toll booths creation APIs are already available
- Pricing varies as per the vehicle type but is independent of the route
- No need to implement database
- Vehicle is identified by its registration number
Demonstrations
- If a vehicle has a valid pass, let it through
- If a vehicle has an invalid pass, display 3 options for passes with prices and let the user choose one and issue the pass
- Display leaderboard for each both for sales made in last 1 hour.