Reserve Me A Seat!

Ever reserved a seat in a cinema? Which seats would you prefer?
Corner seats - 🚫, Centre seats - ✔️





Do you think there is any priority for allocating you a seat in a cinema? No, there is no condition based allocation.
What about buses and trains?
Yes there can be priority wise allotments. There can be several criteria for determining the priority. When we talk about the Railway Reservation System, what can we take into consideration for determining the Priority?

Age : We can prioritize the reservation for senior citizens
Gender :  We can prioritize the reservation for female citizens
Disability : Handicapped citizens are given the priority
Quota : General waiting  > Tatkal > foreign quota

In one of our previous blogs, we went through the reservation – booking and cancellation blocks. After the user inputs all the above information during booking process, we can check the priority at administrative end. Let us consider the Age and Gender as our criteria.
The function can be inherited from the functions of passenger class and operator class.




We check the age and gender of the current code the pointer is pointing to. Where is this priority checked? After the user enters age and gender, call the priority function  in reservation block and return back the priority.

new_node->priority=priority(new_node);
if(new_node->priority==0)
{
cout<<"\n\n\t\t\t\tREGISTRATION UNSUCCESSFUL";

return;
}

In the priority code, we can add the user in waiting list if the train gets full. We can also use the different criteria mentioned earlier for determining the priority. Priority determination is very important in a system like - Railway Reservation.

Similarly, we can have priority based cancellation. We can also apply conditions on refund according to the priority. Go through the priority code for cancelling a ticket, i.e. deleting a node from the linked list : 











Now that we are done with selecting our priorities, we must head towards the user-friendly functions in our system.


Your Seat has been booked, you can continue with our blog!

- Aditya Wyawahare
(K84)

Comments

Post a Comment

Popular posts from this blog

Do you have a ticket?

It's moderator's Office

Dynamic Memory Allocation in C++