38
Central Academy Sr. Sec. School Taramandal Road, Siddharth Nagar, Gorakhpur 2012-13 Computer Science Project Work on “Building a System on Railway Reservations; With Administrator and User Privilege level.” Submitted by: Under Guidance of: Prashant Sinha Mr. Shahabuddin Page | 1

CBSE computer Science Project on Railway Reservation System

Embed Size (px)

DESCRIPTION

Topics covered:1. Object oriented programing2. Objectives3. Source Code.4. Output.Please see "Supernumerary sheets" for additional contents.

Citation preview

Page 1: CBSE computer Science Project on Railway Reservation System

Central Academy

Sr. Sec. SchoolTaramandal Road, Siddharth Nagar, Gorakhpur

2012-13

Computer Science Project Work on

“Building a System on Railway Reservations;

With Administrator and User Privilege level.”

Submitted by: Under Guidance of:

Prashant Sinha Mr. Shahabuddin KhanXII A1 PGT in Computer ScienceRoll number: 5675351 Central Academy

Gorakhpur

Page | 1

Page 2: CBSE computer Science Project on Railway Reservation System

Central AcademySr. Sec. School

Gorakhpur

Certificate of Guidance

This is to certify that this project is submitted by Prashant Sinha to the

computer department, Central Academy Sr. Sec. School, Gorakhpur;

was carried out by him under the guidance and supervision of Mr. Shahabuddin Khan, during academic session 2012-2013.

Date: 19/January/2013

Mr. Shahabuddin Khan

PGT in Computer Science

Central Academy Gorakhpur

External Examiner:-

Internal Examiner:-

Page | 2

Page 3: CBSE computer Science Project on Railway Reservation System

1 TABLE OF CONTENTS

1 Certificate of Guidance2

Table of contents 3

2 Acknowledgement 4

3 Declaration 5

1 Objective 6

2 Introduction to Object Oriented Programming 7

3 About the Project: 9

3.1 SYSTEM REQUIREMENTS 9

3.2 General notes: 9

4 Source Code 10

5 Output: 25

6 Bibiliography 34

Page | 3

Page 4: CBSE computer Science Project on Railway Reservation System

2 ACKNOWLEDGEMENT

I wish to express my deep gratitude and sincere thanks to Mr. Shahabuddin Khan, (PGT in Computer Science; Central Academy Gorakhpur) for his encouragement and for all the guidance that he provided for this project work. I sincerely appreciate this magnanimity taking me into his fold for which I shall remain indebted to him. I extend my hearty thanks to Mrs. Radha Chadha, (Principal, Central Academy) for providing infrastructure necessary for successful completion of this project. I take this opportunity to express my deep sense of gratitude for my parents for invaluable guidance, constant encouragement, constructive comments, sympathetic attitude and immense motivation which has sustained my effort at all stages of my life.

Prashant SinhaXII A1Board Roll number: 5675351

Page | 4

Page 5: CBSE computer Science Project on Railway Reservation System

3 DECLARATION

I do hereby declare that this project work has been originally carried out by Prashant Sinha, XII A1, under the guidance and supervision of Mr. Shahabuddin Khan, (PGT in Computer Science; Central Academy Gorakhpur).

Page | 5

Page 6: CBSE computer Science Project on Railway Reservation System

1 OBJECTIVE

The purpose of the experiment is - to build a Railway Reservation System in C++.

And using prime features of Object oriented programming language.

Page | 6

Page 7: CBSE computer Science Project on Railway Reservation System

2 INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

Object oriented programming is an evolving technology that uses “objects” which interact with each other to make more concise code, save programming time and prevent human error.   You can develop Object oriented programs in any high level language such as C.   However, the implementation of new languages such as C++ will use its features to their true potential.   Object oriented programming has key fundamental concepts that make it work so concisely.   These concepts are classes, objects, methods, inheritance, abstraction, polymorphism and encapsulation.

Object-oriented programming was introduced in the 1960’s as way in which software quality could be maintained as advancing technology had forced hardware and software to become increasingly complex.   Xerox PARC originally created the term ‘object-oriented programming’.   They used it to determine a computer application that would use objects as the foundation for computation. (Exforsys.com, 2009)

Traditionally, programming has placed an emphasis on logic and actions. Structured programming uses a top down approach, whereas object oriented programming places an emphasis on objects and information, using a bottom up approach.   The idea initially, was to shift the emphasis on data, rather than processes.   Programs would contain modules (objects) that were bundled with the software.   These modules had their own data structure and could be directly manipulated.

In simpler words;

A type of programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data structure. In this way, the data structure becomes an object that includes both data and functions. In addition, programmers can create relationships between one object and another. For example, objects can inherit characteristics from other objects.

One of the principal advantages of object-oriented programming techniques over procedural programming techniques is that they enable programmers to create modules that do not need to be changed when a

Page | 7

Page 8: CBSE computer Science Project on Railway Reservation System

new type of object is added. A programmer can simply create a new object that inherits many of its features from existing objects. This makes object-oriented programs easier to modify.

To perform object-oriented programming, one needs an object-oriented programming (OOPL). Java, C++ and Smalltalk are three of the more popular languages, and there are also object-oriented versions of Pascal.

Page | 8

Page 9: CBSE computer Science Project on Railway Reservation System

3 ABOUT THE PROJECT:We are all associated with railways in one way or the other. This Project gives an ideal picture of the Electronic Railway Reservation System. It provides functions to help us to book and close an existing Reservation. It also provides functions to perform basic operations such as viewing and changing details of Database by administrator.

It provides two different login methods, one for administrator, other for general user.

3.1SYSTEM REQUIREMENTS Pentium/Celeron(300 MHz or above) 16 MB RAM 5 MB free space Floppy Disk Drive/Compact Disk Drive Windows 3.x or higher Turbo C++ 3.5 or higher

3.2GENERAL NOTES:Although actual reservation system is rather complicated; this system shows a very obscure view. I covers all the major functionality which should be present in any system. Although data are saved in clean text, so anyone unauthorised can vies and change the values.

Page | 9

Page 10: CBSE computer Science Project on Railway Reservation System

4 SOURCE CODE#include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #include <iostream.h> #include <time.h> #include <iomanip.h> #include <fstream.h>

char f[10] = "f";char s[10] = "s";int addr, ad, flag, f1, d, m, i, amt;float tamt;class login{    public: char id[100]; char pass[100]; char * password; void getid() { cout << "Enter your id:"; gets(id); password = getpass("Enter the password:"); strcpy(pass, password); } void displayid() { cout << "Id:"; puts(id); cout << "Password:"; puts(pass); }};class detail{    public: int tno; char tname[100];

char bp[100]; char dest[100]; int c1, c1fare; int c2, c2fare; int d, m, y; void getdetail() { cout << "Enter the details as follows\n"; cout << "Train no:"; cin >> tno;

Page | 10

Page 11: CBSE computer Science Project on Railway Reservation System

cout << "Train name:"; gets(tname); cout << "Boarding point:"; gets(bp); cout << "Destination pt:"; gets(dest); cout << "No of seats in first class & fare per ticket:"; cin >> c1 >> c1fare; cout << "No of seats in second class & fare per ticket:"; cin >> c2 >> c2fare; cout << "Date of travel:"; cin >> d >> m >> y; } void displaydetail() { cout << tno << "\t" << tname << "\t" << bp << "\t" << dest << "\t"; cout << c1 << "\t" << c1fare << "\t" << c2 << "\t" << c2fare << "\t"; cout << d << "-" << m << "-" << y << "\t" << endl; }};class reser{    public: int pnr; int tno; char tname[100]; char bp[10]; char dest[100]; char pname[10][100]; int age[20]; char clas[10]; int nosr; int i; int d, m, y; int con;

float amc; void getresdet() { cout << "Enter the details as follows\n"; cout << "Train no:"; cin >> tno; cout << "Train name:"; gets(tname); cout << "Boarding point:"; gets(bp); cout << "Destination pt:"; gets(dest); cout << "No of seats required:"; cin >> nosr; for (i = 0; i < nosr; i++) { cout << "Passenger name:"; gets(pname[i]);

Page | 11

Page 12: CBSE computer Science Project on Railway Reservation System

cout << "Passenger age:"; cin >> age[i]; } cout << "Enter the class f-first class s-second class:"; gets(clas); cout << "Date of travel:"; cin >> d >> m >> y; cout << "Enter the concession category\n"; cout << "1.Military\n2.Senior citizen\n"; cout << "3.Children below 5 yrs\n4.None\n"; cin >> con; cout << "............END OF GETTING DETAILS............\n"; } void displayresdet() { cout << "...............................................\n"; cout << "...............................................\n"; cout << "Pnr no:" << pnr; cout << "\nTrain no:" << tno; cout << "\nTrain name:"; puts(tname); cout << "Boarding point:"; puts(bp); cout << "Destination pt:"; puts(dest); cout << "No of seats reserved:" << nosr; for (i = 0; i < nosr; i++) { cout << "Passenger name:"; puts(pname[i]); cout << "Passenger age:" << age[i]; }

cout << "\nYour class:"; puts(clas); cout << "\nDate of reservation:" << d << "-" << m << "-" << y; cout << "\nYour concession category:" << con; cout << "\nYou must pay:" << amc << endl; cout << "***********************************************\n"; cout << ".........END OF RESERVATION.................\n"; cout << "***********************************************\n"; }};class canc{    public: int pnr; int tno; char tname[100]; char bp[10]; char dest[100]; char pname[10][100]; int age[20]; int i; char clas[10];

Page | 12

Page 13: CBSE computer Science Project on Railway Reservation System

int nosc; int d, m, y; float amr; void getcancdet() { cout << "Enter the details as follows\n"; cout << "Pnr no:"; cin >> pnr; cout << "Date of cancellation:"; cin >> d >> m >> y; cout << "...........END OF GETTING DETAILS...........\n"; } void displaycancdet() { cout << "...........................................\n"; cout << "...........................................\n"; cout << "Pnr no:" << pnr; cout << "\nTrain no:" << tno; cout << "\nTrain name:"; puts(tname); cout << "Boarding point:"; puts(bp);

cout << "Destination pt:"; puts(dest); cout << "\nYour class:"; puts(clas); cout << "no of seats to be cancelled:" << nosc; for (i = 0; i < nosc; i++) { cout << "Passenger name:"; puts(pname[i]); cout << "passenger age:" << age[i]; } cout << "\nDate of cancellation:" << d << "-" << m << "-" << y; cout << "\nYou can collect:" << amr << "rs" << endl; cout << "*****************************************\n"; cout << ".........END OF CANCELLATION.............\n"; cout << "*****************************************\n"; }};void manage();void can();void user();void database();void res();void reserve();void displaypassdetail();void cancell();void enquiry();void main(){ clrscr(); int ch;

Page | 13

Page 14: CBSE computer Science Project on Railway Reservation System

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: database(); break; case 2: user(); break; case 3: exit(0); } } while (ch <= 3); getch();}void database(){ char * password; char * pass = "12345678"; password = getpass("Enter the admininistrator password:"); detail a; fstream f; 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"; goto h; } if (strcmp(pass, password) == 0) { char c; do { cout << "...........ADMINISTRATOR MENU...........\n"; cout << "1.Create detail data base\n2.Add details\n"; cout << "3.Display details\n4.User management\n"; cout << "5.Display passenger details\n6.Return to main menu\n"; cout << "Enter your choice:"; cin >> ch;

Page | 14

Page 15: CBSE computer Science Project on Railway Reservation System

cout << endl; switch (ch) { case 1: f.open("t.txt", ios::out | ios::binary); do { a.getdetail(); f.write((char * ) & a, sizeof(a)); cout << "Do you want to add one more record?\n"; cout << "y-for Yes\nn-for No\n"; cin >> c; } while (c == 'y'); f.close(); break; case 2: f.open("t.txt", ios:: in | ios::out | ios::binary | ios::app); a.getdetail(); f.write((char * ) & a, sizeof(a)); f.close(); break; case 3: f.open("t.txt", ios:: in | ios::out | ios::binary | ios::app); f.seekg(0); while (f.read((char * ) & a, sizeof(a))) { a.displaydetail(); } f.close(); break; case 4: manage(); break; case 5: displaypassdetail(); break; } } while (ch <= 5);

f.close(); }    h:}void reserve(){ int ch; do { cout << "1.Reserve\n2.Return to the main menu\n"; cout << "Enter your choice:"; cin >> ch; cout << endl; switch (ch) {

Page | 15

Page 16: CBSE computer Science Project on Railway Reservation System

case 1: res(); break; } } while (ch == 1); getch();}void res(){ detail a; reser b; fstream f1, f2; time_t t; f1.open("t.txt", ios:: in | ios::out | ios::binary); f2.open("p.txt", ios:: in | ios::out | ios::binary | ios::app); int ch; b.getresdet(); while (f1.read((char * ) & a, sizeof(a))) { if (a.tno == b.tno) { if (strcmp(b.clas, f) == 0) { if (a.c1 >= b.nosr)

{ amt = a.c1fare; addr = f1.tellg(); ad = sizeof(a.c1); f1.seekp(addr - (7 * ad)); a.c1 = a.c1 - b.nosr; f1.write((char * ) & a.c1, sizeof(a.c1)); if (b.con == 1) { cout << "Concession category:MILITARY PERSONNEL\n";

b.amc = b.nosr * ((amt * 50) / 100); } else if (b.con == 2) { cout << "Concession category:SENIOR CITIZEN\n"; b.amc = b.nosr * ((amt * 60) / 100); } else if (b.con == 3) { cout << "Concession category:CHILDERN BELOW FIVE\n"; b.amc = 0.0; } else if (b.con == 4) { cout << "You cannot get any concession\n"; b.amc = b.nosr * amt; } srand((unsigned) time( & t));

Page | 16

Page 17: CBSE computer Science Project on Railway Reservation System

b.pnr = rand(); f2.write((char * ) & b, sizeof(b)); b.displayresdet(); cout << "------------------------------------------------------\n"; cout << "--------------Your ticket is reserved-----------\n"; cout << "-----------------End of reservation menu-------\n"; } else { cout << "**********Sorry req seats not available********\n";

} } else if (strcmp(b.clas, s) == 0) { if (a.c2 >= b.nosr) { amt = a.c2fare; addr = f1.tellg(); ad = sizeof(a.c2); f1.seekp(addr - (5 * ad)); a.c2 = a.c2 - b.nosr; f1.write((char * ) & a.c2, sizeof(a.c2)); if (b.con == 1) { cout << "Concession category:MILITARY PRESONNEL\n"; b.amc = b.nosr * ((amt * 50) / 100); } else if (b.con == 2) { cout << "Concession category:SENIOR CITIZEN\n"; b.amc = b.nosr * ((amt * 60) / 100); } else if (b.con == 3) { cout << "Concession category:CHILDERN BELOW FIVE\n"; b.amc = 0.0; } else if (b.con == 4) { cout << "You cannot get any concession\n"; b.amc = b.nosr * amt; } f2.write((char * ) & b, sizeof(b)); b.displayresdet(); cout << "---------------------------------------\n"; cout << "--------Your ticket is reserved--------\n"; cout << "------------End of reservation---------\n"; } else

{ cout << "********Sorry req no of seats not available*******\n";

Page | 17

Page 18: CBSE computer Science Project on Railway Reservation System

} } getch();

goto h; } else { flag = 0; } } if (flag == 0) { cout << "............Wrong train no......................\n"; cout << "......Enter the train no from the data base.....\n"; } f1.close(); f2.close(); getch();    h:}void displaypassdetail(){ fstream f; reser b; f.open("p.txt", ios:: in | ios::out | ios::binary); f.seekg(0); while (f.read((char * ) & b, sizeof(b))) { b.displayresdet(); } f.close(); getch();}void enquiry(){

fstream f; f.open("t.txt", ios:: in | ios::out | ios::binary); detail a; while (f.read((char * ) & a, sizeof(a))) { a.displaydetail(); } getch();}void cancell(){ detail a; reser b; canc c; fstream f1, f2, f3; f1.open("t.txt", ios:: in | ios::out | ios::binary); f2.open("p.txt", ios:: in | ios::out | ios::binary);

Page | 18

Page 19: CBSE computer Science Project on Railway Reservation System

f3.open("cn.txt", ios:: in | ios::out | ios::binary); cout << "**********CANCELLATION MENU*********\n"; c.getcancdet(); while (f2.read((char * ) & b, sizeof(b))) { if (b.pnr == c.pnr) { c.tno = b.tno; strcpy(c.tname, b.tname); strcpy(c.bp, b.bp); strcpy(c.dest, b.dest); c.nosc = b.nosr; for (int j = 0; j < c.nosc; j++) { strcpy(c.pname[j], b.pname[j]); c.age[j] = b.age[j]; } strcpy(c.clas, b.clas); if (strcmp(c.clas, f) == 0) { while (f1.read((char * ) & a, sizeof(a))) {

if (a.tno == c.tno) { a.c1 = a.c1 + c.nosc; d = a.d; m = a.m; addr = f1.tellg(); ad = sizeof(a.c1); f1.seekp(addr - (7 * ad)); f1.write((char * ) & a.c1, sizeof(a.c1)); tamt = b.amc; if ((c.d == d) && (c.m == m)) { cout << "You are cancelling at the date of departure\n"; c.amr = tamt - ((tamt * 60) / 100); } else if (c.m == m) { cout << "You are cancelling at the month of departure\n"; c.amr = tamt - ((tamt * 50) / 100); } else if (m > c.m) { cout << "You are cancelling one month before the date of departure\n"; c.amr = tamt - ((tamt * 20) / 100); } else { cout << "Cancelling after the departure\n"; cout << "Your request cannot be completed\n"; }

Page | 19

Page 20: CBSE computer Science Project on Railway Reservation System

goto h; c.displaycancdet(); } } } else if (strcmp(c.clas, s) == 0) { while (f1.read((char * ) & a, sizeof(a))) {

if (a.tno == c.tno) { a.c2 = a.c2 + c.nosc; d = a.d; m = a.m; addr = f1.tellg(); ad = sizeof(a.c2); f1.seekp(addr - (5 * ad)); f1.write((char * ) & a.c2, sizeof(a.c2)); tamt = b.amc; if ((c.d == d) && (c.m == m)) { cout << "You are cancelling at the date of departure\n"; c.amr = tamt - ((tamt * 60) / 100); } else if (c.m == m) { cout << "You are cancelling at the month of departure\n"; c.amr = tamt - ((tamt * 50) / 100); } else if (m > c.m) { cout << "You are cancelling one month before the date of departure\n"; c.amr = tamt - ((tamt * 20) / 100); } else { cout << "Cancelling after the departure\n"; cout << "Your request cannot be completed\n"; } goto h; c.displaycancdet(); } } } } else { flag = 0;

} }    h: if (flag == 0)

Page | 20

Page 21: CBSE computer Science Project on Railway Reservation System

{ cout << "Enter the correct pnr no\n"; } f1.close(); f2.close(); f3.close(); getch();}void can(){ int ch; do { cout << ".................CANCELLATION MENU.........\n"; cout << "1.Cancell\n2.Return to the main menu\n"; cout << "Enter your choice:"; cin >> ch; cout << endl; switch (ch) { case 1: cancell(); break; } } while (ch == 1); getch();}void user(){ login a; int ch; cout << "*****************************************************\n"; cout << "***********WELCOME TO THE USER MENU**\n"; cout << "****************************************************\n"; char * password;

fstream f; f.open("id.txt", ios:: in | ios::out | ios::binary); char id[100]; puts("Enter your id:"); gets(id); password = getpass("Enter your password:"); while (f.read((char * ) & a, sizeof(a))) { if ((strcmp(a.id, id) == 0) && (strcmp(a.pass, password) == 0)) { do { cout << "1.Reserve\n2.Cancell\n3.Enquiry\n4.Return to the main menu\n"; cout << "Enter your choice:"; cin >> ch; cout << endl; switch (ch) { case 1:

Page | 21

Page 22: CBSE computer Science Project on Railway Reservation System

reserve(); break; case 2: cancell(); break; case 3: enquiry(); break; } } while (ch <= 3); goto j; } else { d = 1; } } if (d == 1) { cout << "Enter your user id and password correctly\n"; }

getch();    j:}void manage(){ int ch; fstream f; char c; login a; cout << ".........WELCOME TO THE USER MANAGEMENT MENU........\n"; do { cout << "1.Create id data base\n2.Add details\n"; cout << "3.Display details\n4.Return to the main menu\n"; cout << "Enter your choice:"; cin >> ch; cout << endl; switch (ch) { case 1: f.open("id.txt", ios::out | ios::binary); do { a.getid(); f.write((char * ) & a, sizeof(a)); cout << "Do you want to add one more record\n"; cout << "y-Yes\nn-No\n"; cin >> c; } while (c == 'y'); f.close(); break; case 2: f.open("id.txt", ios:: in | ios::out | ios::binary | ios::app); a.getid();

Page | 22

Page 23: CBSE computer Science Project on Railway Reservation System

f.write((char * ) & a, sizeof(a)); f.close(); break; case 3: f.open("id.txt", ios:: in | ios::out | ios::binary);

f.seekg(0); while (f.read((char * ) & a, sizeof(a))) { a.displayid(); } f.close(); break; } } while (ch <= 3); getch();}

Page | 23

Page 24: CBSE computer Science Project on Railway Reservation System

5 OUTPUT:(As Rendered in CodeBlocks)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--------WELCOME TO RAILWAY RESERVATION SYSTEM---------~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^^1.Admin mode2.User mode3.ExitEnter your choice:1

Enter the admininistrator password:*********Enter the password correctlyYou are not permitted to logon this mode^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^^1.Admin mode2.User mode3.ExitEnter your choice:1

Enter the admininistrator password:*********-------------ADMINISTRATOR MENU-----------------------

1.Create detail data base2.Add details3.Display details4.User management5.Display passenger details6.Return to main menuEnter your choice:1

Enter the details as followsTrain no:123Train name:yercaud expBoarding point:erodeDestination pt:chennaiNo of seats in first class & fare per ticket:100 200No of seats in second class & fare per ticket:200 100Date of travel:2 3 2009Do you want to add one more record?y-for Yes

Page | 24

Page 25: CBSE computer Science Project on Railway Reservation System

n-for NoyEnter the details as followsTrain no:124Train name:shatapti expBoarding point:chennaiDestination pt:bombayNo of seats in first class & fare per ticket:300 200No of seats in second class & fare per ticket:200 300Date of travel:4 5 2009Do you want to add one more record?y-for Yesn-for Non-----------------ADMINISTRATOR MENU------------------1.Create detail data base2.Add details3.Display details4.User management5.Display passenger details6.Return to main menuEnter your choice:2

Enter the details as followsTrain no:126Train name:kurula expBoarding point:bombayDestination pt:chennaiNo of seats in first class & fare per ticket:200 300No of seats in second class & fare per ticket:300 200Date of travel:4 3 2009

-----------------ADMINISTRATOR MENU------------------1.Create detail data base2.Add details3.Display details4.User management5.Display passenger details6.Return to main menuEnter your choice:3Trno Trname Bpt Dest Fs Ffare Ss Sfare Date of dep123 yercaud exp erode chennai 100 200 200 100 2-3-2009

124 shatapti exp chennai bombay 300 200 200 300 4-5-2009

126 kurula exp bombay chennai 200 300 300 200 4-3-2009

-----------------ADMINISTRATOR MENU------------------1.Create detail data base2.Add details

Page | 25

Page 26: CBSE computer Science Project on Railway Reservation System

3.Display details4.User management5.Display passenger details6.Return to main menuEnter your choice:4

-----------WELCOME TO THE USER MANAGEMENT MENU--------1.Create id data base2.Add details3.Display details4.Return to the main menuEnter your choice:1

Enter your id:ashwinEnter the password:**********Do you want to add one more recordy-Yesn-NoyEnter your id:ajinthEnter the password:**********Do you want to add one more recordy-Yesn-NoyEnter your id:balaEnter the password:********Do you want to add one more recordy-Yesn-NoyEnter your id:hemanthEnter the password:*********Do you want to add one more recordy-Yesn-Non1.Create id data base2.Add details3.Display details4.Return to the main menuEnter your choice:2Enter your id:berlinEnter the password:*********1.Create id data base2.Add details3.Display details4.Return to the main menuEnter your choice:3Id:ashwin

Page | 26

Page 27: CBSE computer Science Project on Railway Reservation System

Password:11111111Id:ajinthPassword:22222222Id:balaPassword:33333333Id:premPassword:44444444Id:hemanthPassword:55555555Id:berlinPassword:666666661.Create id data base2.Add details3.Display details4.Return to the main menuEnter your choice:4

-----------------ADMINISTRATOR MENU------------------

1.Create detail data base2.Add details3.Display details4.User management5.Display passenger details6.Return to main menuEnter your choice:5.

-----------------ADMINISTRATOR MENU------------------1.Create detail data base2.Add details3.Display details4.User management5.Display passenger details6.Return to main menuEnter your choice:6^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^1.Admin mode2.User mode3.ExitEnter your choice:2****************************************************************WELCOME TO THE USER MENU**************************************************************************Enter your id:ashwinEnter your password:*********Enter your user id and password correctly

Page | 27

Page 28: CBSE computer Science Project on Railway Reservation System

^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^^1.Admin mode2.User mode3.ExitEnter your choice:2****************************************************************WELCOME TO THE USER MENU**************************************************************************Enter your id:ashwinEnter your password:*********1.Reserve2.Cancell3.Enquiry4.Return to the main menuEnter your choice:11.Reserve2.Return to the main menuEnter your choice:1Enter the details as followsTrain no:123Train name:yercaudBoarding point:erodeDestination pt:chennaiNo of seats required:10Passenger name:rajaPassenger age:45Passenger name:raguPassenger age:32Passenger name:raviPassenger age:34Passenger name:vinothPassenger age:23Passenger name:rajuPassenger age:24Passenger name:lathaPassenger age:45Passenger name:malaPassenger age:23Passenger name:vimalaPassenger age:32Passenger name:kathirPassenger age:12Passenger name:kosiPassenger age:43Enter the class f-first class s-second class:fDate of travel:2 2 2009Enter the concession category1.Military

Page | 28

Page 29: CBSE computer Science Project on Railway Reservation System

2.Senior citizen3.Children below 5 yrs4.None4--------------END OF GETTING DETAILS------------You cannot get any concession------------------------------------------------Pnr no:10770Train no:123Train name:yercaudBoarding point:erodeDestination pt:chennaiNo of seats reserved:10Passenger name:rajaPassenger age:45Passenger name:raguPassenger age:32Passenger name:raviPassenger age:34Passenger name:vinothPassenger age:23Passenger name:rajuPassenger age:24Passenger name:lathaPassenger age:45Passenger name:malaPassenger age:23Passenger name:vimalaPassenger age:32Passenger name:kathirPassenger age:12Passenger name:kosiPassenger age:43Your class:fDate of reservation:2-2-2009Your concession category:4You must pay:2000*****************************************************----------------END OF RESERVATION-------------------*****************************************************

-------------Your ticket is reserved------------------------------End of reservation menu-----------------1.Reserve2.Return to the main menuEnter your choice:2

1.Reserve2.Cancell3.Enquiry4.Return to the main menuEnter your choice:3

Trno Trname Bpt Dest Fs Ffare Ss Sfare Date of dep

123 yercaud exp erode chennai 90 200 200 100 2-3-2009

124 shatapti exp chennai bombay 300 200 200 300 4-5-2009

126 kurula exp bombay chennai 200 300 300 200 4-3-2009

Page | 29

Page 30: CBSE computer Science Project on Railway Reservation System

1.Reserve2.Cancell3.Enquiry4.Return to the main menuEnter your choice:2

*********************CANCELLATION MENU*******************Enter the details as followsPnr no:10770Date of cancellation:2 3 2009------------------END OF GETTING DETAILS-----------------You are cancelling at the date of departure------------------------------------------------------------------------------------------------------------------

Pnr no:10770Train no:123Train name:yercaudBoarding point:erodeDestination pt:chennaiYour class:fno of seats to be cancelled:10Passenger name: raja passenger age: 45Passenger name: ragu passenger age: 32Passenger name: ravi passenger age: 34Passenger name: vinoth passenger age: 23Passenger name: raju passenger age: 24Passenger name: latha passenger age:45Passenger name: mala passenger age: 23Passenger name: vimala passenger age: 32Passenger name: kathir passenger age: 12Passenger name: kosi passenger age: 43Date of cancellation:2-3-2009You can collect: 800rs********************************************************----------------END OF CANCELLATION---------------------********************************************************1.Reserve2.Cancell3.Enquiry4.Return to the main menuEnter your choice:2*****************CANCELLATION MENU*********************Enter the details as followsPnr no:12234Date of cancellation:2 3 2009---------------END OF GETTING DETAILS------------------Enter the correct pnr no

Page | 30

Page 31: CBSE computer Science Project on Railway Reservation System

1.Reserve2.Cancell3.Enquiry4.Return to the main menuEnter your choice:3

Trno Trname Bpt Dest Fs Ffare Ss Sfare Date of dep

123 yercaud exp erode chennai 100 200 200 100 2-3-2009

124 shatapti exp chennai bombay 300 200 200 300 4-5-2009

126 kurula exp bombay chennai 200 300 300 200 4-3-2009

1.Reserve2.Cancell3.Enquiry4.Return to the main menuEnter your choice:3

Trno Trname Bpt Dest Fs Ffare Ss Sfare Date of dep

123 yercaud exp erode chennai 100 200 200 100 2-3-2009

124 shatapti exp chennai bombay 300 200 200 300 4-5-2009

126 kurula exp bombay chennai 200 300 300 200 4-3-2009

1.Reserve2.Cancell3.Enquiry4.Return to the main menuEnter your choice:1

1.Reserve2.Return to the main menuEnter your choice:1Enter the details as followsTrain no:12345Train name:shataptiBoarding point:chennaiDestination pt:bombayNo of seats required:1Passenger name:rajaPassenger age:23Enter the class f-first class s-second class:fDate of travel:3 2 2009Enter the concession category1.Military2.Senior citizen

Page | 31

Page 32: CBSE computer Science Project on Railway Reservation System

3.Children below 5 yrs4.None4----------------END OF GETTING DETAILS-------------------------------Wrong train no-----------------------------Enter the train no from the data base-------1.Reserve2.Return to the main menuEnter your choice:21.Reserve2.Cancell3.Enquiry4.Return to the main menuEnter your choice:4

^^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^1.Admin mode2.User mode3.Exit

^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^1.Admin mode2.User mode3.ExitEnter your choice:1Enter the admininistrator password:*********-----------------ADMINISTRATOR MENU------------------1.Create detail data base2.Add details3.Display details4.User management5.Display passenger details6.Return to main menuEnter your choice:5-----------------ADMINISTRATOR MENU------------------

1.Create detail data base2.Add details3.Display details4.User management5.Display passenger details6.Return to main menuEnter your choice:6^^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^1.Admin mode2.User mode3.Exit

Page | 32

Page 33: CBSE computer Science Project on Railway Reservation System

Enter your choice:3

6 BIBILIOGRAPHY1. Arora, Sumitra; Computer Science in C++ ; 2012 ; Dhanpat Rai

and Co.

Page | 33