You are on page 1of 51

Guide: Lokesh Kumar, CS Teacher, 9811162650

Computer Science Project


on
Computerized DVD
Renting

PROJECT PREPARED BY:


Name
Class
Session
Boards Roll Number

: ABC
: XII-C
: 2014-2015
: 9161111

Delhi Public School, Vasant Kunj

Guide: Lokesh Kumar, CS Teacher, 9811162650

TABLE OF CONTENTS
Certificate
Acknowledgement
Working description of project
Header files and their purpose
Files generated
Coding & outputs

Guide: Lokesh Kumar, CS Teacher, 9811162650

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

Boards Roll Number : 9161111


Delhi Public School,

Guide: Lokesh Kumar, CS Teacher, 9811162650

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.

Ms. Saumya Gohain


PGT, Computer Science
Delhi Public School,
VasantKunj

Guide: Lokesh Kumar, CS Teacher, 9811162650

HEADER FILES USED AND THEIR


PURPOSE
1. FSTREAM.H for file handling, cin and
cout
2. CONIO.H for clrscr() and getch() functions
3. STDIO.H for standard I/O operations

Guide: Lokesh Kumar, CS Teacher, 9811162650

FILES GENERATED
DATA FILES
MEMBER.DAT
DVD.DAT
RENT.DAT
PROGRAM FILE
DVD.CPP
OBJECT FILE
DVD.OBJ
EXECUTION FILE
DVD.EXE

Guide: Lokesh Kumar, CS Teacher, 9811162650

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.

1.2 OBJECTIVES OF THE PROPOSED SYSTEM

To reduce time for the organization

To increase efficiency and accuracy of the system

To reduce pressure on the labour and relieving man power from repetitive and dull job

To make the retrieval of information faster

Guide: Lokesh Kumar, CS Teacher, 9811162650

To make the system more feasible

To reduce large amount of paper work

To make the system more reliable to avoid any ambiguity.

To reduce the cost factor of the system

To make the system more flexible.

1.3 ADVANTAGES OF THE PROPOSED SYSTEM

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

Reduces pressure on the labour.

Makes the system more feasible and flexible and thus retrieval of information becomes
convenient.

1.4Coding

#include<fstream.h>

Guide: Lokesh Kumar, CS Teacher, 9811162650

#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;
}
};

Guide: Lokesh Kumar, CS Teacher, 9811162650

class member:public date


{
int mid;
char name[30],address[50],phone[15];
public:
void getmember()
{
cout<<"\n\nEnter membership number \t: ";
cin>>mid;
cout<<"\n\nEnter member's name

\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: ";

Guide: Lokesh Kumar, CS Teacher, 9811162650

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;

Guide: Lokesh Kumar, CS Teacher, 9811162650

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;

Guide: Lokesh Kumar, CS Teacher, 9811162650

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();

Guide: Lokesh Kumar, CS Teacher, 9811162650

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;

Guide: Lokesh Kumar, CS Teacher, 9811162650

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)))
{

Guide: Lokesh Kumar, CS Teacher, 9811162650

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();
}

Guide: Lokesh Kumar, CS Teacher, 9811162650

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()
{

Guide: Lokesh Kumar, CS Teacher, 9811162650

fstream file, file2;


int num;
member m;
int found=0;
file.open("member.dat",ios::in|ios::binary);
file2.open("temp.dat",ios::out|ios::binary);
cout<<"\n\nEnter membership no. to be deleted: ";
cin>>num;
while(file.read((char*)&m,sizeof(m)))
{
if(num==m.ret_mid())
found=1;
else
file2.write((char*)&m,sizeof(m));
}
file.close();
file2.close();
remove("member.dat");
rename("temp.dat","member.dat");

Guide: Lokesh Kumar, CS Teacher, 9811162650

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);

Guide: Lokesh Kumar, CS Teacher, 9811162650

cout<<"\nEnter DVD's Description : ";


gets(desc);
}
void showdvd()
{
cout<<"\n\nDvd No

\t: ";

cout<<did;
cout<<"\nDVD's Name

\t: "<<dname;

cout<<"\nDVD's Description\t: "<<desc;


}
int ret_did()
{
return did;
}
};
void add_dvd();
int search_dvd();
void del_dvd();
void disp_dvd();

Guide: Lokesh Kumar, CS Teacher, 9811162650

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();

Guide: Lokesh Kumar, CS Teacher, 9811162650

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;

Guide: Lokesh Kumar, CS Teacher, 9811162650

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";
}

Guide: Lokesh Kumar, CS Teacher, 9811162650

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));
}

Guide: Lokesh Kumar, CS Teacher, 9811162650

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();

Guide: Lokesh Kumar, CS Teacher, 9811162650

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:

void getrent(int mid, int did)


{

Guide: Lokesh Kumar, CS Teacher, 9811162650

mem_id=mid; dvd_id=did;
cout<<"\n\nDVD ID

:\t"<<dvd_id;

cout<<"\nMember ID

:\t"<<mem_id;

cout<<"\n\nEnter rent id no.: ";


cin>>rid;
cout<<"\n\nDate of issue :\t";
doi.getdate();
cout<<"\n\nDate of return:\t";
dor.getdate();
cout<<"\n\nEnter rent

:\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";

Guide: Lokesh Kumar, CS Teacher, 9811162650

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";

Guide: Lokesh Kumar, CS Teacher, 9811162650

{
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);

Guide: Lokesh Kumar, CS Teacher, 9811162650

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;

Guide: Lokesh Kumar, CS Teacher, 9811162650

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);

Guide: Lokesh Kumar, CS Teacher, 9811162650

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 ";
}

Guide: Lokesh Kumar, CS Teacher, 9811162650

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();

Guide: Lokesh Kumar, CS Teacher, 9811162650

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();

Guide: Lokesh Kumar, CS Teacher, 9811162650

}
cout<<"\nPress any key to continue........";
getch();
clrscr();
}
}

Outputs

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

Guide: Lokesh Kumar, CS Teacher, 9811162650

You might also like