seat reservation algorithm C#

Dimitar Ivanov 1 Reputation point
2021-02-03T19:29:13.66+00:00

I'm working on bus ticket reservation system. I have a problem in the booking module.

Say we have bus a route starts from "A" to "D" via "B" & "C"

The bus starts from "A" then reach "B", then "C" and final destination is "D".

Assume some one is reserving seat no "1" for "B" to "C", this seat no should not be available for the person who is searching for a seat to travel from "A" to "D" or "B" to "D" but the same seat should be available for "A" to "B" or "C" to "D"

Example in Summary

Seat No 1 is Reserved for "B" to "C"

Seat No 1 should not be available for "A"-"D"
Seat No 1 should not be available for "B"-"D"
Seat No 1 should not be available for "B"-"C"
Seat No 1 should be available for "A" to "B"
Seat No 1 should be available for "C" to "D"

Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Abdulhakim M. Elrhumi 356 Reputation points
    2021-02-03T21:45:13.89+00:00

    Hi
    Create two lists array for seat one is availablelist other resirvedlist.

    Best Regards.
    Please remember to mark the replies as answers if they help.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.