Professional Documents
Culture Documents
Yash Pal
Roll No. Class XII D
GuruharkrishanPublic School
Loni Road, Shahdara, Delhi
Contents
1. Certificate
2. Acknowledgement
3. Source Code
4. Output Screenshots of Major Features.
.: Certificate :.
This is to certify that vaibhav goel , student of Class XII
A, AIR FORCE SCHOOL, HINDAN has completed the
project titled “Travel Agency” during the academic year
2017–2018 towards fulfillment of credit for the
Computer Science practical evaluation of CBSE 2018,
under my supervision.
Mr.VIVEK
Department of Computer Science
AIR FORCE SCHOOL,HINDAN
.: Acknowledgements :.
/*****************************/
/* PROJECT TRAVEL AGENCY */
/*****************************/
/*************************/
/* INCLUDED HEADER FILES */
/*************************/
#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <dos.h>
/*****************************************************
**************/
// THIS CLASS CONTAIN ALL THE FUNCTION RELATED TO
TICKET
// LIKE RESERVATION, DELETION, ETC.
/*****************************************************
**************/
class TRAVEL
{
public :
void INFORMATION(void) ;
void RESERVATION(void) ;
int RESERVED(int,int,int,int,int) ;
int AVAIL(int,int,int,int) ;
void DELETION(void) ;
void LIST_OF_PASS(void) ;
void PASS_INFO(void) ;
void MAINMENU(void) ;
private :
intbusno, seatno ;
char name[26], sex ;
int age, fair ;
intdd, mm, yy ;
} ;
char *place[3]={"Jaipur","Nainital","Chandigarh"} ;
int price[3]={220,220,210} ;
/***************************************************/
/* THIS FUNCTION DISPLAY THE PASSENGER INFORMATION */
/***************************************************/
cout<<"****************************************" ;
gotoxy(1,25) ;
cout<<"Press any key to continue..." ;
getch() ;
break ;
}
}
file.close() ;
if (!found)
{
cout<<"\n\n\7 Passenger record not found" ;
getch() ;
}
}
cout<<"***************************************" ;
fstream file ;
file.open("BUS.DAT", ios::in) ;
while (file.read((char *) this, sizeof(TRAVEL)))
{
if (busno == bno)
{
if ((toupper(ch) == 'N') || ((toupper(ch) == 'Y') &&
(dd == d && mm == m &&yy == y)))
{
found = 1 ;
gotoxy(5,row) ;
cout<<seatno ;
gotoxy(14,row) ;
cout<<name ;
gotoxy(43,row) ;
cout<<sex ;
gotoxy(50,row) ;
cout<<age ;
gotoxy(61,row) ;
cout<<dd<<"/"<<mm<<"/"<<yy ;
row++ ;
if (row == 25)
{
getch() ;
for (inti=8; i<=24; i++)
{
gotoxy(1,i) ;
clreol() ;
}
row = 8 ;
}
}
}
}
file.close() ;
if (!found)
{
cout<<"\n\n\n\n\n\7 No Reservation for the bus no.
"<<bno ;
getch() ;
return ;
}
cout<<"\n\nPress any key to continue..." ;
getch() ;
}
/************************************************/
/* FUNCTION TO RESERVE TICKET FOR THE PASSENGER */
/************************************************/
clrscr() ;
gotoxy(5,5) ;
cout<<"*********************************" ;
gotoxy(28,7) ;
cout<<"K. D. TRAVEL AGENCY" ;
gotoxy(10,9) ;
cout<<"BUS NO. " <<bno<<"\t\t\t\tDate : " <<d <<"/"
<<m <<"/" <<y ;
gotoxy(10,10) ;
cout<<"Seat no. : " <<sno ;
gotoxy(35,12) ;
cout<<"From : Delhi" <<"\tTo : " <<place[bno-1] ;
gotoxy(10,15) ;
cout<<"Passenger name : " <<pname ;
gotoxy(10,16) ;
cout<<"Passenger age : " <<page <<"\t\tSex : " <<psex
;
gotoxy(10,18) ;
cout<<"Total Fair : " <<price[bno-1] ;
gotoxy(5,20) ;
cout<<"**************************************" ;
cout<<"\n\n\n" ;
do
{
cout<<"Do you want to save ticket (y/n) " ;
cin>>ch ;
} while (toupper(ch) != 'Y' &&toupper(ch) != 'N') ;
if (toupper(ch) == 'N')
return ;
fstream file ;
file.open("BUS.DAT", ios::app) ;
busno = bno ;
seatno = sno ;
strcpy(name,pname) ;
sex = psex ;
age = page ;
fair = pfair ;
dd = d ;
mm = m ;
yy = y ;
file.write((char *) this, sizeof(TRAVEL)) ;
file.close() ;
}
/**********************************************/
/* FUNCTION TO DELETE RECORD OF THE PASSENGER */
/**********************************************/
void TRAVEL :: DELETION(void)
{
clrscr() ;
intbno=0, found=0, sno, d, m, y ;
charch ;
cout<<"\n Bus 1 : Delhi to Jaipur. <Fare Rs.220>"
;
cout<<"\n Bus 2 : Delhi to Nainital. <Fare Rs.480>"
;
cout<<"\n Bus 3 : Delhi to Chandigarh. <Fare Rs.210>"
;
do
{
cout<<"\n\n Enter the bus no. (1/2/3) " ;
cin>>bno ;
} while (bno< 1 || bno> 3) ;
cout<<"\n\nEnter the Date of the reserved ticket (dd
mm yyyy) : " ;
cin>>d >>m >>y ;
cout<<"\nEnter the Seat no. : " ;
cin>>sno ;
if (sno> 60 || sno< 1 || !RESERVED(bno,d,m,y,sno))
{
cout<<"\n\n\n Sorry!\7 Seat not reserved" ;
getch() ;
return ;
}
fstream file, temp ;
file.open("BUS.DAT", ios::in) ;
temp.open("TEMP.DAT", ios::out) ;
while (file.read((char *) this, sizeof(TRAVEL)))
{
if ((dd == d && mm == m &&yy == y) &&bno == busno&&sno
== seatno)
{
found = 1 ;
clrscr() ;
gotoxy(5,5) ;
cout<<"***************************************" ;
gotoxy(28,7) ;
cout<<"K. D. TRAVEL AGENCY" ;
gotoxy(10,9) ;
cout<<"BUS NO. " <<bno<<"\t\t\t\tDate : " <<d <<"/"
<<m <<"/" <<y ;
gotoxy(10,10) ;
cout<<"Seat no. : " <<sno ;
gotoxy(35,12) ;
cout<<"From : Delhi" <<"\tTo : " <<place[bno-1] ;
gotoxy(10,15) ;
cout<<"Passenger name : " <<name ;
gotoxy(10,16) ;
cout<<"Passenger age : " <<age <<"\t\tSex : " <<sex ;
gotoxy(10,18) ;
cout<<"Total Fair : " <<price[bno-1] ;
gotoxy(5,20) ;
cout<<"****************************************" ;
do
{
gotoxy(1,25) ; clreol() ;
cout<<"Do you want to Delete (y/n) " ;
cin>>ch ;
} while (toupper(ch) != 'Y' &&toupper(ch) != 'N') ;
if (toupper(ch) == 'N')
temp.write((char *) this, sizeof(TRAVEL)) ;
}
else
temp.write((char *) this, sizeof(TRAVEL)) ;
}
file.close() ;
temp.close() ;
if (!found)
{
cout<<"\n\n\7 Passenger record not found" ;
getch() ;
return ;
}
if (toupper(ch) == 'N')
return ;
file.open("BUS.DAT", ios::out) ;
temp.open("TEMP.DAT", ios::in) ;
while (temp.read((char *) this, sizeof(TRAVEL)))
file.write((char *) this, sizeof(TRAVEL)) ;
file.close() ;
temp.close() ;
}
/*****************************************************
****************/
/* MAIN FUNCTION WHICH DISPLAY MAIN MENU & CALLS ALL
OTHER FUNCTIONS */
/*****************************************************
****************/
void MAINMENU(void)
{
TRAVEL travel ;
charch ;
while (1)
{
clrscr() ;
gotoxy(26,5) ;
cout<<"***************************" ;
gotoxy(26,6) ;
cout<<"* K. D. TRAVEL AGENCY *" ;
gotoxy(26,7) ;
cout<<"***************************" ;
gotoxy(29,10) ;
cout<<"1 :: INTRODUCTION" ;
gotoxy(29,11) ;
cout<<"2 :: RESERVATION" ;
gotoxy(29,12) ;
cout<<"3 :: DELETE RECORD" ;
gotoxy(29,13) ;
cout<<"4 :: PASSENGER LIST" ;
gotoxy(29,14) ;
cout<<"5 :: PASSENGER INFO." ;
gotoxy(29,15) ;
cout<<"6 :: QUIT" ;
gotoxy(29,18) ;
cout<<"Enter your choice :: " ;
ch = getche() ;
if (ch == 27 || ch == '6')
break ;
else
if (ch == '1')
travel.INFORMATION();
else
if (ch == '2')
travel.RESERVATION() ;
else
if (ch == '3')
travel.DELETION() ;
else
if (ch == '4')
travel.LIST_OF_PASS() ;
else
if (ch == '5')
travel.PASS_INFO() ;
}
}
void main(void)
{
MAINMENU();
}
Outputs