Hi,
I have a problem with a logic. Can anybody help me?
The scenario is very much the same for Online Hotel room bookings. Say there are $iNumRooms in a hotel. User who wishes to book should select the start date & end date for which booking is required. If rooms are available for the selected dates (both the dates inclusive) then book rooms for that user else display the date since bookings are available.
At no time in the hotel the rooms booked for the day should exceed $iNumRooms.
Say for eg if $iNumRooms = 3
User 1 books for 02-09-2003 to 02-15-2003
User 2 books for 02-11-2003 to 02-17-2003
User 3 books for 02-13-2003 to 02-19-2003
And if user 4 tries to book for 02-14-2003 to 02-20-2003, Since for 14th all the 3 rooms are full, it should say that there are no bookings available for selected date. It should instead tell user the date when the rooms will be available.
Hope this makes sense.
Any help in this regard will be appreciated.
Veeral