Anda di halaman 1dari 18

COMPUTER SCIENCE

INVESTIGATORY PROJECT
THEATRE MANAGEMENT

Submitted by:
Ayushi Shakya
XII-A

CERTIFICATE OF COMPLETION
This is to certify that

AYUSHI SHAKYA of class XII-A


has completed the chemistry project entitled

THEATRE MANAGEMENT
herself and under my guidance.

Mr. Atul Verma


(P.G.T. CHEMISTRY)
KENDRIYA VIDYALAYA
ANDREWS GANJ

DECLARATION
I hereby declare that the project work entitled
Theatre Management, submitted to Department of
Computer Science, Kendriya Vidyalaya Andrews Ganj,
New Delhi is prepared by me. All the coding is result
of my personal efforts.

Ayushi Shakya
XII-A

ACKNOWLEDGEMENT
I would like to express my special thanks of gratitude to
my teacher Mr. Atul Verma as well as our principal Mrs.
Rashmi Mishra who gave me the golden opportunity to do
this wonderful project on the topic theatre management,
which also helped me in doing a lot of Research and i came
to know about so many new things I am really thankful to
them.
Secondly i would also like to thank my parents and friends
who helped me a lot in finalizing this project within the
limited time frame.

Ayushi Shakya

XII-A

HEADER FILES
IOSTREAM.H : to implement cin and cout statements.
FSTREAM.H : for file handling
CONIO.H : for clrscr() function
PROCESS.H : for exit() function
STDIO.H : for gets(), puts() functions
STDLIB.H :
STRING.H : for strcmpi() function

WORKING DESCRIPTION

This program is a replica of theatre management database


systems. It includes the following functions:
1.Enter details of a movie
2.Search for a movie
3.Purchase tickets
4.Modify details of a movie
5.Delete a movie
6.Display details of all movies
7.Exit program

CODING
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<process.h>
#include<stdio.h>

#include<stdlib.h>
#include<string.h>
fstream file;
class Theatre
{
char MID[6];
char MovName[31];
char code[4];
char rating[6];
char cast[51];
double Price;
char dura[21];
char Dir[21];
char show[21];
public:
void Enter();
void Search();
void Ticket();
double TotalPrice(int);
void Modify();
void Display();
void Delete();
} MOV;
void main()
{
char ch;
int choice;
do
{
clrscr();
cout<<"\n\t ========= MOVIE RESERVATION =========\n";
cout<<"\n\t 1:-> ENTER A MOVIE \n\t 2:-> SEARCH FOR A MOVIE \n";
cout<<"\t 3:-> PURCHASE TICKETS \n\t 4:-> MODIFY DETAIILS \n\t";
cout<<" 5:-> DELETE A MOVIE \n\t 6:-> DISPLAY \n\t 7:-> EXIT PROGRAM \n";
cout<<"\t =====================================" ;
cout<<"\n\n\t Enter your choice : ";
cin>>choice;
switch(choice)
{
case 1: file.open("Movie.dat", ios::out | ios::binary | ios::app );

MOV.Enter();
file.write((char*)&MOV, sizeof(MOV));
file.close();
break;
case 2: MOV.Search();
break;
case 3: MOV.Ticket();
break;
case 4: MOV.Modify();
break;
case 5: MOV.Delete();
break;
case 6: file.open("Movie.dat", ios::in | ios::binary);
while(file.read((char*)&MOV, sizeof(MOV)))
{
MOV.Display();
}
file.close();
break;
case 7: cout<<"\tPROGRAM TERMINATED";
exit(0);
break;
default: cout<<"\t Wrong Choice ! \n\t ABORTING !!!";
}
cout<<"\n\n\t Want to enter more? (y/n/Y/N): ";
cin>>ch;
} while(ch=='y'|| ch=='Y');
}
void Theatre:: Enter()
{
cout<<"\n\n\t Movie id : ";
cin>>MID;
cout<<"\n\t Enter movie name : ";
gets(MovName);
cout<<"\n\t Content code : ";
cin>>code;
cout<<"\n\t Rating : ";
cin>>rating;
cout<<"\n\t Director : ";
gets(Dir);
cout<<"\n\t Cast : ";

gets(cast);
cout<<"\n\t Duration : ";
gets(dura);
cout<<"\n\t Show timings : ";
gets(show);
cout<<"\n\t Ticket cost : ";
cin>>Price;
}
void Theatre:: Search()
{
file.open("Movie.dat", ios::binary | ios:: in);
int found=0;
char temp[5];
cout<<"\n\n\t Enter the movie id to be searched : ";
cin>>temp;
while(file.read((char*)&MOV, sizeof(MOV)))
{
if(strcmpi(temp,MID)==0)
{
found=1;
MOV.Display();
}
}
file.close();
if(found==0)
cout<<"\t Movie id : "<<temp<<" does not exist";
}
double Theatre:: TotalPrice(int no)
{
return no*Price;
}
void Theatre:: Ticket()
{
char date[11], cname[21], mname[21];
int num;
cout<<"\n\t Enter date : ";
cin>>date;
cout<<"\t Enter customer name : ";
gets(cname);

cout<<"\t Enter movie name : ";


gets(mname);
cout<<"\t Enter number of seats to be occupied : ";
cin>>num;
file.open("Movie.dat", ios::binary | ios:: in);
cout<<"\n\n\n\t DETAILS";
cout<<"\n\t Date : ";
puts(date);
cout<<"\t Customer name : ";
puts(cname);
int found=0;
while(file.read((char*)&MOV, sizeof(MOV)))
{
if(strcmpi(mname,MovName)==0)
{
found=1;
MOV.Display();
}
}
file.close();
if(found==1)
cout<<"\t Amount to be paid : "<<MOV.TotalPrice(num);
else
cout<<"\t ERROR!";
}

void Theatre:: Display()


{
cout<<"\n\n\t Movie id : "<<MID;
cout<<"\n\t Movie name : ";
puts(MovName);
cout<<"\t Content code : "<<code;
cout<<"\n\t Rating : "<<rating;
cout<<"\n\t Cast : "<<cast;
cout<<"\n\t Director : ";
puts(Dir);
cout<<"\t Cast : ";
puts(cast);

cout<<"\t Duration : ";


puts(dura);
cout<<"\t Show timings : ";
puts(show);
}
void Theatre:: Delete()
{
char temp[5];
file.open("Movie.dat", ios::binary | ios::in);
ofstream fout("temp.dat", ios::binary | ios::out);
cout<<"\n\n\t Enter Movie id to delete : ";
cin>>temp;
while(file.read((char*)&MOV, sizeof(MOV)))
{
if(strcmpi(temp,MID)!=0)
fout.write((char*)&MOV, sizeof(MOV));
}
file.close();
fout.close();
remove("Movie.dat");
rename("temp.dat","Movie.dat");
cout<<"\t MOVIE deleted";
}
void Theatre:: Modify()
{file.open("Movie.dat", ios::binary | ios::in | ios::out);
char id[6],s[21];
float p;
cout<<"\n\t Enter Movie ID : ";
gets(id);
while(file.read((char*)&MOV, sizeof(MOV)))
{
if(strcmpi(id,MOV.MID)==0)
{
cout<<"\n\t Enter new price : ";
cin>>p;
Price=p;
cout<<"\n\t Enter new show timings :";
cin>>s;
strcpy(show,s);

Display();
}
}
file.close();
}

OUTPUT
1. HOMESCREEN

2. ENTER DETAILS OF A MOVIE

2. SEARCH FOR A MOVIE

3. PURCHASE MOVIE TICKETS

4. MODIFY DETAILS OF A MOVIE

5. DELETE A MOVIE

6. DISPLAY DETAILS OF ALL THE MOVIES

7. EXIT PROGRAM

BIBLIOGRAPHY
Computer science with C++ by Sumita Arora
www.google.com
en.wikipedia.org
Object oriented programming by Robert Lafore