Professional Documents
Culture Documents
: ABC
: XII-C
: 2014-2015
: 9161111
TABLE OF CONTENTS
Certificate
Acknowledgement
Working description of project
Header files and their purpose
Files generated
Coding & outputs
ACKNOWLEDGEMENT
It is my utmost pleasure to express my
sincere thanks and gratitude to my
Computer
Science
Teacher
Ms.
.. in providing help and
guidance for the project. The unflagging
patience,
creativity
and
immense
knowledge that she shared with me has
proved highly beneficial to me and has
made this project both possible and
successful.
ABC
XII C
Session
: 2014-2015
VasantKunj
CERTIFICATE
This is to certify that . of
class XII C has completed her project
titled Computerised Dvd Renting
under my guidance & this project may be
considered as the part of the practical
exam of CBSE 2015 conducted by CBSE.
FILES GENERATED
DATA FILES
MEMBER.DAT
DVD.DAT
RENT.DAT
PROGRAM FILE
DVD.CPP
OBJECT FILE
DVD.OBJ
EXECUTION FILE
DVD.EXE
WORKING DESCRIPTION OF
PROJECT
COMPUTERISED DVD RENTING aims at developing into software that can be used at
places like Delhi for renting of dvds in shops.
The main advantage of this project is that it converts all the manual work which is time
consuming and error prone to fully automated system which helps in eliminating all the paper
work, saves time, improves customer services. It also speeds up various processes such as
keeping the details of members and dvds thus providing convenience to the workers as well as
customers.
In the development of the project , selection of an appropriate programming language and
a platform is of primary importance. In this project C++ language is used to maintain all
the data. It provides many features like file handling ,data can be easily maintained and
many features that are required while doing a project.
1.1 PROBLEM DEFINITION
The project is developed for Renting of Dvds, which aims to automate its various tasks.
All the work of various tasks were earlier carried out manually. However in the course of
time it was realized that manual work is error prone and time consuming.
To reduce pressure on the labour and relieving man power from repetitive and dull job
Converts all the manual work which is time consuming and error prone to fully
automated system
Helps in eliminating all the paper work, saves time and improves customer services.
C++ has support for most of the web servers available today
Makes the system more feasible and flexible and thus retrieval of information becomes
convenient.
1.4Coding
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
class date
{
int dd,mm,yy;
public:
void getdate()
{
cout<<"\n\n Enter date : ";
cout<<"\n Date : "; cin>>dd;
cout<<"Month : "; cin>>mm;
cout<<"Year : "; cin>>yy;
}
void showdate()
{
cout<<" "<<dd<<"-"<<mm<<"-"<<yy;
}
};
\t: ";
gets(name);
cout<<"\n\nEnter member's address \t: ";
gets(address);
cout<<"\n\nEnter contact number
gets(phone);
}
void showmember()
{
cout<<"\n\nMembership No\t: ";
\t: ";
cout<<mid;
cout<<"\n\n Member's name \t: "<<name;
cout<<"\n\n Address
cout<<"\n\n Contact no.
}
int ret_mid()
{
return mid;
}
};
void line()
{
cout<<"\n";
for(int i=1;i<=40;i++)
cout<<"_";
}
void add_mem();
int search_mem();
void edit_mem();
\t: "<<address;
\t: "<<phone;
void del_mem();
void disp_mem();
void member_menu()
{
char ch;
while(1)
{ clrscr();
cout<<"\n\nWELCOME TO MEMBER MANAGEMENT";
line();
cout<<"\n\n1.Add a member";
cout<<"\n\n2.Delete a member";
cout<<"\n\n3.Edit a member";
cout<<"\n\n4.Show all members";
cout<<"\n\n0.Exit";
cout<<"\n\n\nEnter your choice\t";
ch=getche();
if(ch=='0')
break;
switch(ch)
{
case'1':add_mem();
break;
case'2':del_mem();
break;
case'3':edit_mem();
break;
case'4':disp_mem();
}
cout<<"\n\tPress any key to continue....";
getch();
}
}
void add_mem()
{
member m;fstream file;
cout<<"\nEnter member details: ";
line();
m.getmember();
file.open("member.dat",ios::app|ios::binary);
file.write((char*)&m,sizeof(m));
file.close();
}
int search_mem()
{
int num,found=0;fstream file;
member m;
cout<<"\n\nEnter desired member id : ";
cin>>num;
file.open("member.dat",ios::in|ios::binary);
while(!found&&file.read((char*)&m,sizeof(m)))
{
if(num==m.ret_mid())
{
cout<<"\n\n Member found\n\n";
m.showmember();
found=1;
break;
}
}
file.close();
if(!found)
{ num=-1;
cout<<"\n\nMember not found ";
}
return(num);
}
void edit_mem()
{
int num,found=0; member m;
fstream file;
file.open("member.dat",ios::in|ios::out|ios::binary);
cout<<"\n\nEnter membership no. : ";
cin>>num;
while(!found&&file.read((char*)&m,sizeof(m)))
{
if(num==m.ret_mid())
{
cout<<"\n\n Member found ";
cout<<"\n\n Current details are: ";
line();
m.showmember();
cout<<"\n\nEnter new details ";
m.getmember();
int pos=file.tellg()-sizeof(m);
file.seekg(pos);
file.write((char*)&m,sizeof(m));
found++;
break;
}
}
if(!found)
cout<<"\n\nMember does not exist ";
file.close();
}
void disp_mem()
{
fstream file;
member m;
int cnt=0;
file.open("member.dat",ios::in|ios::binary);
cout<<"\n\nDetails of members are ";
line();
while(file.read((char*)&m,sizeof(m)))
{
m.showmember();
cnt++;
}
file.close();
line();
cout<<"\n\n\t"<<cnt<<" members found";
}
void del_mem()
{
if(found==1)
cout<<"\n\nRecord deleted";
else
cout<<"\n\nRecord not deleted";
}
class dvd
{
int did;
char dname[30];
char desc[40];
public:
void getdvd()
{
cout<<"\n\nEnter DVD's number : ";
cin>>did;
cout<<"\n\nEnter DVD's Title : ";
gets(dname);
\t: ";
cout<<did;
cout<<"\nDVD's Name
\t: "<<dname;
void dvd_menu()
{
char ch;
while(1)
{
cout<<"\n\n DVD MANAGEMENT";
line();
cout<<"\n\n1.Add a dvd";
cout<<"\n\n2.Delete a DVD";
cout<<"\n\n3.Show all dvds";
cout<<"\n\n0.Exit";
cout<<"\n\n\nEnter your choice\t";
ch=getche();
if(ch=='0')
break;
switch(ch)
{
case'1':add_dvd();
break;
case'2':del_dvd();
break;
case'3':disp_dvd();
}
}
}
void add_dvd()
{
dvd d; fstream file;
cout<<"\nEnter dvd details: ";
d.getdvd();
file.open("dvd.dat",ios::app|ios::binary);
file.write((char*)&d,sizeof(d));
file.close();
}
int search_dvd()
{
int nu,found=0;fstream file;
dvd d;
cout<<"\n\nEnter desired dvd id : ";
cin>>nu;
file.open("dvd.dat",ios::in|ios::binary);
while(!found&&file.read((char*)&d,sizeof(d)))
{
if(nu==d.ret_did())
{
cout<<"\n\n Dvd found\n\n";
d.showdvd();
found=1;
break;
}
}
file.close();
if(!found)
{ nu=-1;
cout<<"\n\nDvd not found";
}
return(nu);
}
void del_dvd()
{
fstream file,file2;
int num;
dvd d;
int found=0;
file.open("dvd.dat",ios::in|ios::binary);
file2.open("temp.dat",ios::out|ios::binary);
cout<<"\n\nEnter DVD no. to be deleted: ";
cin>>num;
while(file.read((char*)&d,sizeof(d)))
{
if(num==d.ret_did())
found=1;
else
file2.write((char*)&d,sizeof(d));
}
file.close();
file2.close();
remove("dvd.dat");
rename("temp.dat","dvd.dat");
if(found)
cout<<"\n\nRecord deleted ";
else
cout<<"\n\nRecord not deleted ";
}
void disp_dvd()
{
fstream file;
dvd d;
int cnt=0;
file.open("dvd.dat",ios::in|ios::binary);
cout<<"\n\nDetails of DVDs are: ";
line();
while(file.read((char*)&d,sizeof(d)))
{
d.showdvd();
cnt++;
}
file.close();
cout<<"\n\n"<<cnt<<" DVDs found ";
}
class rent
{
int rid;
int dvd_id, mem_id;
date doi,dor;
float rent;
public:
mem_id=mid; dvd_id=did;
cout<<"\n\nDVD ID
:\t"<<dvd_id;
cout<<"\nMember ID
:\t"<<mem_id;
:\t";
cin>>rent;
}
void showrent()
{
cout<<"\n\nRent ID no: \t";
cout<<rid;
cout<<"\n\nDVD ID no: \t";
cout<<dvd_id;
cout<<"\n\nMember ID no:\t";
cout<<mem_id;
cout<<"\n\ndate of issue:\t";
doi.showdate();
cout<<"\n\ndate ofreturn:\t";
dor.showdate();
cout<<"\n\nRent:
cout<<rent;
}
int ret_rid()
{
return rid;
}
};
void issue_dvd()
{
rent r; fstream file;
int mem_id,dvd_id;
dvd_id=search_dvd();
if(dvd_id!=-1)
\t";
{
mem_id=search_mem();
if(mem_id!=-1)
{
//cout<<"\n\nEnter details of dvd: ";
r.getrent(mem_id, dvd_id);
file.open("rent.dat",ios::app|ios::binary);
file.write((char*)&r,sizeof(r));
file.close();
}
}
}
void find()
{
int n,found=0;fstream file;
rent r;
cout<<"\n\nEnter dvd's id: ";
cin>>n;
file.open("rent.dat",ios::in|ios::binary);
while(!found&&file.read((char*)&r,sizeof(r)))
{
if(n==r.ret_rid())
{
cout<<"\n\n Dvd found\n\n";
r.showrent();
found=1;
break;
}
}
file.close();
if(!found)
cout<<"\n\nDvd not found";
}
void disp_rent()
{
fstream file;
rent r;
int cnt=0;
file.open("rent.dat",ios::in|ios::binary);
cout<<"\n\nDetails of dvd are: ";
line();
while(file.read((char*)&r,sizeof(r)))
{
r.showrent();
cnt++;
}
file.close();
cout<<"\n\n"<<cnt<<"dvd found";
}
void ret_dvd()
{
fstream file,file2;
int n;
rent r;
int found=0;
file.open("rent.dat",ios::in|ios::binary);
file2.open("temp.dat",ios::out|ios::binary);
cout<<"\n\nEnter dvd no. to be deleted: ";
cin>>n;
while(file.read((char*)&r,sizeof(r)))
{
if(n==r.ret_rid())
found=1;
else
file2.write((char*)&r,sizeof(r));
}
file.close();
file2.close();
remove("rent.dat");
rename("temp.dat","rent.dat");
if(found)
cout<<"\n\nRecord deleted ";
else
cout<<"\n\nRecord not deleted ";
}
void main()
{
char c;
clrscr();
while(1)
{
cout<<"\n\n WELCOME TO S&S DVD RENTAL CENTRE ";
line();
cout<<"\n\n1.Rent a dvd";
cout<<"\n\n2.Search a rented dvd";
cout<<"\n\n3.Return a dvd";
cout<<"\n\n4.Search a Member";
cout<<"\n\n5.Search a DVD";
cout<<"\n\n6.Show all rented DVDs";
cout<<"\n\n7.Member management";
cout<<"\n\n8.DVD Management";
cout<<"\n\n0.Exit ";
cout<<"\n\n\n Your choice is : ";
c=getche();
if(c=='0')
break;
switch(c)
{
case'1':issue_dvd();
break;
case'2':find();
break;
case'3':ret_dvd();
break;
case'4':search_mem();
break;
case'5':search_dvd();
break;
case'6':disp_rent();
break;
case'7':member_menu();
break;
case'8':dvd_menu();
}
cout<<"\nPress any key to continue........";
getch();
clrscr();
}
}
Outputs