Railway Online Booking
Railway Online Booking
BOOKING SYSTEM
   DESIGN AND
IMPLEMENTATION
GROUP MEMBERS-
− DARSH SHARMA – 18BCE0679
− MEHUL AGARWAL – 18BCE0625
− RAJIV SHANKARNARAYANAN – 18BCE0774
− SAUMYA VERMA – 18BCE0321
− SITARAMASWAMY GEDDAM – 18BCE0289
SLOT - L39+L40
                                       PAGE 1
ABSTRACT-
In this paper, we find out more about the usefulness of
computerized passenger reservation system and
introduce one approach to online transaction and
usefulness in rough sets. Comparing with the method to
get most interesting methods, ours is direct and objective.
Interest must consider the predefined knowledge on what
kind of information is interesting. Our method greatly
reduces the rule numbers generated and provides a
measure of its usefulness at the same time. Apart from the
obvious advantage of being computerized over manual
reservation and enquiry, this paper explores other
advantage of implementing this system and its future.
If this project is successfully applied successfully by the
INDIAN RAILWAY CATERING AND TOURISM
CORPORATION then it will make ticket booking and
reservation Simpler and Efficient.
                                                         PAGE 2
AIM-
Railway Ticket Reservation using online ticketing system.
This system helps in collecting passenger data, searching
for destinations, fare display and adding new trains and
editing old routes and payment methods.
OBJECTIVE-
Our objective is to Link passengers information to their
desired seats and trains and make ticket booking and
reservation a simpler task.
APPLICABILITY-
The railway lines and passengers have been increasing
year by year in the country. With such a huge customer
base, buying train tickets problem has been very
prominent. The electronic commerce could solve the
problem of railway ticketing. Introduced a new online
ticketing system is not only technological innovation, but
also will improve the railway services, to a certain extent,
solve the difficult problem of railway ticketing.
                                                        PAGE 3
INTRODUCTION-
The seat/ berth reservation on trains is pretty complex
activity, not only because of the volumes involving seats/
berth reservations per day, but also because of several
different categories of trains that are operating. This
method of calculation of fare is also quite complex as
charges are based on distance, comfort level and transit
time. Also, there were many infirmities with the manual
system like the current status did not get updated, it was
slow and time consuming, inadvertent errors and
malpractices in reservation were there. Because of the
complexity and sheer volumes involved, there was a need
for development of computerized reservation.
                                                     PAGE 4
LITERATURE REVIEW-
The Indian railway website, IRCTC is the most traffic-filled
site. The tickets are usually booked through this official
site. If you are planning to book tickets the day before
your departure date, tatkal tickets are available from 10:00
AM and ends as soon as the tickets are booked. The
tickets are limited and the demand will be sky-high. If you
are able to reserve a ticket through tatkal, you can get
berth seats. Cancellation of tatkal ticket will not be
refunded. Anyone can reserve tickets through IRCTC. You
can pay through debit card, credit card, international card
and others.
                                                        PAGE 5
LIST OF MODULES-
 1. SAUMYA VERMA – PASSENGER DATA
    COLLECTION AND STORAGE
 2. DARSH SHARMA – SEARCHING FOR
    DESTINATIONS AND DISPLAY OF FARE
 3. MEHUL AGARWAL – ADDING NEW
    TRAINS AND EDITING OLD ROUTES
 4. SITARAMSWAMY GEDDAM –
    SEARCHING BOOKING AND
    CANCELLATION
 5. RAJIV SHANKARNARAYAN –
    DISPLAYING BILLS, PAYMENT OPTIONS
    AND FINAL OUTPUT
                                  PAGE 6
Implementation-
The project is divided into 5 modules and each module is
significantly important for the successful application of the
project. The project has two parts one for the user and
other for the admin.
The user part allows the passenger to book seats via the
use of all the modules and complete the reservation
process by doing the payment.
The admin part allows the admin to add and delete trains.
It allows addition of new trains, editing routes and
discarding old trains. But the admin part can only be
accessed by the authorities by entering the password.
The user part begins by allowing the user to search for a
train, after searching the train the available trains are
displayed and the user can select any one of the trains to
check for availability of seats in that train. After the user
selects the preferred train then he is directed to the
payments page where he can choose the payment method
and complete the method by providing the details of
payment. Then a message for completion of booking is
displayed.
The admin part contains the addition and deletion of
trains. The admin can search for a train and as per his
requirements he can delete the train or update its route.
He can also add new trains to the directory.
                                                        PAGE 7
ARCHITECTURE DIAGRAM-
                        PAGE 8
MODULE DESCRIPTION-
Module 1: Passenger data collection and storage
This module deals with the collection and storage of
Passenger information. To do this we are using a structure
named as ‘passenger’, in that struct we are initializing
name, age, date of journey, starting and destination
stations with their respective data types. We also made a
stack data structure by defining a push function which
initializes a variable in structure and takes the respective
inputs i.e. the passengers name, age, starting and
destination stations and adds the address of that variable
to the stack. To view the previous data entry the user can
use display command to view the data. The next modules
will be able to use the address of the current passenger by
using the pop function on the stack. Each passenger’s
information is stored and can be retrieved any time by just
entering its reservation number or by searching the name
of passenger by using the search module. The use of
pointers in the code of the module helps other functions in
different modules to easily access the passenger info for
further use.
                                                      PAGE 9
Module 2: Searching for destinations and display of
fare
My module is based on searching for the destinations on
which it will show us the distance and number of trains
available. A stack is created which is to search the names
of cities. Another two stacks store the coordinates of the
cities, one for the x coordinate and one for the y
coordinate. A function is created which retains the indices
for accessing the stacks. Another function calls the
previous function and stores the returned value. The value
inputted by the user for departure and arrival location is
taken. Available trains will also be displayed with the date
and time. After displaying the distance of the trains from
the user’s departure till arrival will be displayed so that
they can choose from it. Example,
Departure location – Mumbai
Arrival location   - Delhi
First the function mentioned previously is called in a loop
that executes till the city inputted for departure matches
the cities in the stack. This is done in the method
mentioned later as the method called only returns the
index. The x and y coordinates for the city found is
accessed from the returned index and stored in the
respective variable. The same is done for the arrival
location. The distance between the two cities is found by
using the coordinates stored in the location by the
distance formula.
Distance = Square root ((x1 – x2) ^2 +(y1-y2) ^2)
                                                      PAGE 10
Module 3: Adding new trains and editing old routes
My module can only be used by the authorities. This
module will give the railway authority to add new trains to
the system, it will also allow the authority to change the
routes of old trains and even change the details regarding
the train like number of seats, timings and prices, and it
will also allow the authority to remove the trains that are
no more functioning so that the passengers are not
confused due to availability of wrong trains. The authority
will have a fixed password that will only allow them to
access this module and make the required changes so that
no other person can disrupt the system. Basically, the
work of this module is to give the authority the power to
update the railway system with the latest changes and
keep the system up to date for the convenience of the
users.
                                                      PAGE 11
Module 4: Searching booking and cancelation
The types of functions that are done are as follows:
customer register function, customer cancellation function,
searching function, booking function. Functional blocks of
the system Customer register function is Customers could
order tickets after they login on the system. The
registration information includes user's name, user's
telephone, user's address. According to the customer's
cancellation request, the system could complete the
cancelling operation, delete the user's registration
information from the table in the database. Searching
function: Customers can use the train number or site to site
to query. When they type the information, the system will
return the relevant information to the customers,
including the type of train, the type of the tickets, the
number of remaining tickets, the price of tickets. Booking
function: Customers could order tickets after they login on
the system. They could select the Train Number, sites
interval of trips, the number of train tickets. Refunding
function: Customers may refund their tickets for some
reasons. The system checks tickets information to
determine whether to allow refunding tickets, then returns
the process result.
                                                      PAGE 12
Module 5: Displaying bill, payment options and final
output.
In my module, I have displayed the bill and given an
option for cancellation. The module which takes the input
for the details is called and the passenger information is
displayed as a bill e.g.: name, age, phone number which
is stored in a structure and is easily accessible. Then the
module that selects the train info is called and the train
details such as arrival, date, departure etc are displayed
by using the display function to display the elements of the
stack. The duration of the journey along with the cost of
the ticket will be displayed. An option will be given to the
customer to confirm the ticket, or the ticket can be
cancelled by the customer if he wants to. If he cancels the
program will end and the bill will be displayed as void ad
the program will end. If the customer confirms his ticket,
the bill will be displayed and the payment options will be
displayed, after the user chooses an option, the booking
will be done, if the payment is successful and the program
ends.
                                                      PAGE 13
TIME COMPLEXITY-
Time Complexity of Linked lists (singly-linked)
A linked list can typically only be accessed via its head node.
From there you can only traverse from node to node until
you reach the node you seek. Thus access is O(n).
Searching for a given value in a linked list similarly requires
traversing all the elements until you find that value.
Thus search is O(n).
currNode = head
forever:
if currNode == NULL
     break
cur = cur->Next
firstNode = Head->Next
newNode->Next = firstNode
Head->Next = newNode
                                                          PAGE 14
Deleting from a linked list requires re-pointing the previous
node (the node before the deleted node) to the next node
(the node after the deleted node). Thus deletion is O(1).
if (currNode->data = deletionData)
previousNode->Next = currNode->next;
free(currNode)
                                                        PAGE 15
RESULTS-
           PAGE 16
PAGE 17
REFERENCES-
• Nitesh, Manbir Singh, Rahul Yadav: RESEARCH PAPER
ON STACK AND QUEUE© 2014 IJIRT | Volume 1 Issue 7 |
ISSN: 2349-6002
www.ijirt.org/master/publishedpaper/IJIRT101357_PAPER
.pdf
                                                      PAGE 18
Karuna and Garima Gupta
http://www.ijermt.org/publication/11/IJERMT%20V-1-5-
6.pdf
• IMPLEMENTATION OF ENHANCED SINGLY LINKED LIST
EQUIPPED WITH DLL OPERATIONS: AN APPROACH
TOWARDS ENORMOUS MEMORY SAVING Devishree
Naidu and Abhishek Prasad Jr., Member, IACSIT
http://www.ijfcc.org/papers/276-E1045.pdf
• A STUDY ON THE USAGE OF DATA STRUCTURES IN
INFORMATION RETRIEVAL
https://arxiv.org/ftp/arxiv/papers/1602/1602.07799.pdf •
Nitesh, Manbir Singh, Rahul Yadav Department of
Electronics and Communication Dronacharya College Of
Engineering Farruknagar, Khetawas, Gurgaon
http://www.ijirt.org/master/publishedpaper/IJIRT101357_
PAPER.pdf
• N.M. GIRINIVAS*, P. HEMANAND*, K.P. CHETAN*, S.R.
JANANI UG Student, Assistant Professor Department of
Information Technology, R.M.K Engineering College-
601206, India
https://www.ijcsmc.com/docs/papers/March2015/V4I320
1594.pdf
• Suan Hsi Yong and Susan Horwitz, Computer Sciences
Department, University of WisconsinMadison, POINTER-
RANGE ANALYSIS
https://pdfs.semanticscholar.org/b27d/585a6a6c7733bf21
0f791c365a9cedd29a31.pdf
                                                   PAGE 19
• Nick Parlante Copyright ©1998-2000, Nick Parlante,
Pointers and Memory
http://cslibrary.stanford.edu/102/PointersAndMemory.pd
f
• David Koes, Mihai Budiu, Girish Venkataramani , CS
Department Carnegie Mellon University PROGRAMMER
SPECIFIED POINTER INDEPENDENCE
http://www.cs.cmu.edu/~mihaib/research/msp04.pdf
• Hongxia Peng , Xianhao Xu , Wen Chen , TOURIST
BEHAVIORS IN ONLINE BOOKING June 2013, Vol. 3 Iss. 6,
PP. 280-285
http://www.academicpub.org/downloadpaper.aspx?pape
rid=13505
• Walter Murray and Margaret h. Wright, EFFICIENT
LINEAR SEARCH ALGORITHMS FOR THE LOGARITHMIC
BARRIER FUNCTION, technical report sol. 76-18
September 1976
https://apps.dtic.mil/dtic/tr/fulltext/u2/a033432.pdf
• Morrice Joseph , Palak Keshwani , COMPARISON
BETWEEN LINEAR SEARCH AND BINARY SEARCH
ALGORITHMS - IJARIIT( ISSN: 2454-132X)
https://www.ijariit.com/conference-
proceedings/15%20CSE%20107.pdf
                                                 PAGE 20
CODE:
#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<malloc.h>
#include<string.h>
using namespace std;
struct train
{
          int bs;
          int ds;
          int ns;
          int fare;
          int trno;
          struct train *next;
}*start=NULL,*q,*t;
struct user
{
          char name[100];
          char pass[20];
    int age;
    int utno;
    int uns;
    int ufare;
          struct user *next1;
}*start1,*q1,*t1;
class tra
{
          public:
                      void insertrain()
                      {
                              int bss,dss,nss,fares,trnos;
                              cout<<"\nEnter the Train Number: ";
                                                                    PAGE 21
           cin>>trnos;
           cout<<"\nEnter the Boarding Station City Code: ";
           cin>>bss;
           cout<<"\nEnter the destination Station City Code: ";
           cin>>dss;
           cout<<"\nEnter the no. of seats in the train: ";
           cin>>nss;
           cout<<"\nEnter the fare of the each seat: ";
           cin>>fares;
           int num;
t=(struct train*)malloc(sizeof(struct train));
t->bs=bss;
t->ds=dss;
t->ns=nss;
t->fare=fares;
t->trno=trnos;
    if(start==NULL)
{
t->next=NULL;
start=t;
}
else
{
t->next=start;
start=t;
}
}
void deletetrain()
{
           int bss,dss;
                                                                  PAGE 22
           cout<<"Enter the boarding station city code: ";
           cin>>bss;
           cout<<"Enter the destination station city code: ";
           cin>>dss;
prev->next = temp->next;
           free(temp);
}
void displaytrain()
{
           if(start==NULL)
{
printf("List is empty!!");
}
else
{
q=start;
                                                                PAGE 23
              cout<<"The train list is:\n";
             cout<<"Train Number"<<"\t"<<"BOARDING
STATION"<<"\t"<<"DESTINATION STATION"<<"\t"<<"NO. OF SEATS"<<"\t\t"<<"FARE";
              while(q!=NULL)
              {
              cout<<"\n"<<q->trno<<"\t\t\t"<<q->bs<<"\t\t\t"<<q->ds<<"\t\t\t"<<q-
>ns<<"\t\t"<<"Rs."<<q->fare<<"\n";
              q=q->next;
              }
              }
              }
              void updatetrain()
              {
                      int trnos,nss,fares;
                      displaytrain();
                      cout<<"\nEnter the train number to be updated : ";
                      cin>>trnos;
                                                                                    PAGE 24
                                   else
                                   {
                                           w=w->next;
                                   }
                           }
                           if(w==NULL)
                           {
                                   printf("Train not found");
                           }
                 }
};
class passenger
{
       public:
                 tra tt;
                 void signup()
                 {
                           char names[100],passs[20];
                           int ages;
                           cout<<"\nEnter the User Name: ";
                           cin>>names;
                           cout<<"\nEnter the Age: ";
                           cin>>ages;
                           cout<<"\nEnter the password ";
                           cin>>passs;
                           int num;
                 t1=(struct user*)malloc(sizeof(struct user));
                 strcpy(t1->name,names);
                 t1->age=ages;
                 strcpy(t1->pass,passs);
                                                                 PAGE 25
                 if(start==NULL)
             {
             t1->next1=NULL;
             start1=t1;
             }
             else
             {
             t1->next1=start1;
             start1=t1;
             }
             void login()
             {
                      char names[100],passs[20];
                      cout<<"USERNAME: ";
                      cin>>names;
                      cout<<"PASSWORD: ";
                      cin>>passs;
                                                                                PAGE 26
                              {
                              case 1:
                              {
                                        reservation();
                                        break;
                              }
                              case 2:
                              {
                                        cancel();
                                        break;
                              }
                              }
                       }
                              while(ch11<=2);
             }
              while (temp1 != NULL && (strcmp(temp1->name,names)!=0)&&
(strcmp(temp1->pass,passs)!=0))
             {
             prev1 = temp1;
             temp1 = temp1->next1;
             }
             if (temp1 == NULL) return;
             }
             void reservation()
             {
                    tt.displaytrain();
                    int trno11,nss1,tf;
                    cout<<"Enter Your Train Number for Booking";
                    cin>>trno11;
                                                                         PAGE 27
while(w1!=NULL)
{
      if(w1->trno==trno11)
      {
               cout<<"\nTrain is found";
               cout<<"\nEnter the number of seats: ";
               cin>>nss1;
               if(nss1<=w1->ns)
               {
                        w1->ns=w1->ns-nss1;
                        cout<<"Total Fare: "<<nss1*w1->fare;
                        tf=nss1*w1->fare;
                        payment(tf);
               }
               else
               {
                        cout<<"\nSeats Not Available";
                        cout<<"No. Of seats available: ";
                        cout<<w1->ns;
               }
               break;
      }
      else
      {
               w1=w1->next;
      }
}
if(w1==NULL)
{
      printf("Train not found");
                                                            PAGE 28
                    }
                    return;
             }
             void cancel()
             {
                    char username1[100],passs11[20];
                    cout<<"\nUsername: ";
                    cin>>username1;
                    cout<<"\nPassword: ";
                    cin>>passs11;
                    struct user* temp12 = start1, *prev1;
                    int ch112;
              if (temp12 != NULL && (strcmp(temp12->name,username1)==0)&&
(strcmp(temp12->pass,passs11)==0))
             {
                    cout<<"Enter the number of tickets to be cancelled: ";
                    cin>>ch112;
                    temp12->uns=temp12->uns-ch112;
                    cout<<"\nCancellation Done.";
                                                                             PAGE 29
             if (temp12 == NULL) return;
                        return;
             }
             void payment(int s)
             {
                        cout<<"\nFare Details"<<endl;
                        cout<<"\nThe total fare:"<<s;
                        cout<<"\nChoose the payment options:"<<endl;
                    cout<<"\n1.Credit
card"<<endl<<"\n2.Phonepe"<<endl<<"\n3.NetBanking\n"<<endl;
                        int ch;
                        scanf("%d",&ch);
                        switch(ch)
                        {
                                  case 1:
                                            creditcard();
                                            break;
                                  case 2:
                                            Phonepe();
                                            break;
                                  case 3:
                                            NetBanking();
                                            break;
             }
      }
             char cdno[20];
             int cvv;
             char expiry[8];
                                                                       PAGE 30
void creditcard()
{
       cout<<"Welcome to Billdesk Payment Gateway"<<endl;
       cout<<"Enter the card number:"<<endl;
       cin>>cdno;
       cout<<"Enter the expiry date of the card"<<endl;
       cin>>expiry;
       cout<<"Enter your CVV Number:"<<endl;
       cin>>cvv;
       cout<<"The payment is successful";
}
char upi[5]="6837";
char upi1[5];
void Phonepe()
{
       cout<<"Enter the Upi pin"<<endl;
       cin>>upi1;
       if(strcmp(upi1,upi)==0)
       {
                  cout<<"Payment successful"<<endl;
       }
else
       {
                  cout<<"Payment unsuccessful"<<endl;
                  Phonepe();
       }
}
char userid[10];
char password[10];
char mall[40]="Vellore";
char mall1[40];
                                                            PAGE 31
                    void NetBanking()
                    {
                           cout<<"Netbanking Login:"<<endl;
                           cout<<"Enter the User-id:"<<endl;
                           cin>>userid;
                           cout<<"Enter the password"<<endl;
                           cin>>password;
                           cout<<"What is the mall closest from your house:"<<endl;
                           cin>>mall1;
                           if(strcmp(mall1,mall)==0)
                           {
                                    cout<<"Payment successful"<<endl;
                           }
                           else
                           {
                                    cout<<"Payment unsuccessful"<<endl;
                                    NetBanking();
                           }
                    }
};
void user1()
{
          int ch;
passenger p;
          do
     {
         cout<<"...........USER MENU...........\n";
         cout<<"\n1.SignUp\n2.Login\n";
                                                                                      PAGE 32
        cout<<"3.Return to main menu\n";
        cout<<"Enter your choice:";
        cin>>ch;
                                   char c;
        cout<<endl;
        switch(ch)
        {
        case 1:
            do
                {
                         p.signup();
                    cout<<"Do you want to add one more record?\n";
                    cout<<"y-for Yes\nn-for No\n";
                    cin>>c;
                }
                while(c=='y');
                break;
        case 2:
            do
            {
                         p.login();
                         cout<<"Do you want to login with another account: ";
                         cin>>c;
                                             }
                                             while(c=='y');
                                             break;
        }
    }
    while(ch<=2);
}
void admin()
                                                                                PAGE 33
{
                tra t;
                char password[10];
                char pass[]="admin";
                cout<<"Enter the admin password: ";
                cin>>password;
    int ch;
    char c;
    if(strcmp(pass,password)!=0)
    {
        cout<<"Enter the password correctly \n";
        cout<<"You are not permitted to logon this mode\n";
    }
    if(strcmp(pass,password)==0)
    {
                char c;
        do
        {
            cout<<"...........ADMINISTRATOR MENU...........\n";
            cout<<"1.Add details\n2.Delete details\n3.Update\n";
            cout<<"4.Display details\n";
            cout<<"5.Return to main menu\n";
            cout<<"Enter your choice:";
            cin>>ch;
            cout<<endl;
            switch(ch)
            {
            case 1:
                do
                 {
                          cout<<"Cities"<<"\t\t"<<"Codes";
                                                                   PAGE 34
              cout<<"\nKolkata"<<"\t\t"<<1;
              cout<<"\nDurgapur"<<"\t"<<2;
              cout<<"\nRaniganj"<<"\t"<<3;
              cout<<"\nAsansol"<<"\t\t"<<4;
              cout<<"\nSiliguri"<<"\t"<<5;
         t.insertrain();
         cout<<"Do you want to add one more record?\n";
         cout<<"y-for Yes\nn-for No\n";
         cin>>c;
     }
     while(c=='y');
     break;
case 2:
 do
 {
              t.deletetrain();
              cout<<"Do you want to delete one more record?\n";
         cout<<"y-for Yes\nn-for No\n";
         cin>>c;
                                 }
                                 while(c=='y');
                                 break;
                       case 3:
                                 do
 {
              t.updatetrain();
              cout<<"Do you want to update more record?\n";
         cout<<"y-for Yes\nn-for No\n";
         cin>>c;
                                 }
                                 while(c=='y');
                                 break;
                       case 4:
                                                                  PAGE 35
                                  t.displaytrain();
                break;
            }
        }
        while(ch<=4);
                }
}
int main()
{
    int ch;
    cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
    cout<<".........WELCOME TO RAILWAY RESERVATION SYSTEM........\n";
    cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
    do
    {
        cout<<"^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^\n";
        cout<<"1.Admin mode\n2.User mode\n3.Exit\n";
        cout<<"Enter your choice:";
        cin>>ch;
        cout<<endl;
        switch(ch)
        {
        case 1:
            admin();
            break;
        case 2:
                user1();
                break;
        case 3:
            exit(0);
                                                                         PAGE 36
        }
    }
    while(ch<=3);
    return 0;
}
PAGE 37