I am writing code to book a ticket in railway. I am able to book them however I am unable to understand the approach and logic needs to be applied while writing code when a book