0% found this document useful (0 votes)
78 views30 pages

Computer Science Project On: Computerized DVD Renting'

This document summarizes a computer science project on a "Computerized DVD Renting" system. It includes the following sections: certificate, acknowledgement, header files used and their purpose, files generated, coding and outputs. The coding section includes classes for members, dates, and rentals. Functions are defined for adding, searching, editing, deleting members and rentals. The main function displays a menu to manage members and rent DVDs.

Uploaded by

Nikhil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views30 pages

Computer Science Project On: Computerized DVD Renting'

This document summarizes a computer science project on a "Computerized DVD Renting" system. It includes the following sections: certificate, acknowledgement, header files used and their purpose, files generated, coding and outputs. The coding section includes classes for members, dates, and rentals. Functions are defined for adding, searching, editing, deleting members and rentals. The main function displays a menu to manage members and rent DVDs.

Uploaded by

Nikhil Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Computer Science Project

on
‘Computerized DVD Renting’

PROJECT PREPARED BY:


NIKHIL KUMAR SHARMA XII A

Session: 2013-2014

Board’s Roll Number:9173559

RAMJAS SCHOOL,

R.K.Puram
TABLE OF CONTENTS

➢ Certificate
➢ Acknowledgement
➢ 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 Mr. MUSTAFA 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.

NIKHIL KUMAR SHARMA

XII A

Session: 2013-2014

Board’s Roll Number: 9173559

Ramjas School,

R.K.Puram
CERTIFICATE

This is to certify that Nikhil Kumar Sharma of


class XII A 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 2014
conducted by CBSE.

Mr. MUSTAFA
Teacher, Computer Science
Ramjas School,
R.K.Puram
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
FILES GENERATED

● DATA FILES
MEMBER.DAT
RENT.DAT

● PROGRAM FILE
DVD.CPP

● OBJECT FILE
DVD.OBJ

● EXECUTION FILE
DVD.EXE
Coding

#include<fstream.h>

#include<conio.h>

#include<stdio.h>

class date

int dd,mm,yy;

public:

void getdate()

cout<<"\n\n Enter date (dd mm yy) : ";

cin>>dd>>mm>>yy;

void showdate()

cout<<" "<<dd<<"-"<<mm<<"-"<<yy;

};

class member:public date

int mid;

char name[30],address[50],phone[15];
public:

void getmember()

cout<<"\n\nEnter membership number : ";

cin>>mid;

cout<<"\n\nEnter member's name : ";

gets(name);

cout<<"\n\nEnter member's address : ";

gets(address);

cout<<"\n\nEnter contact number : ";

gets(phone);

void showmember()

cout<<"\n\nMembership No : ";

cout<<mid;

cout<<"\n\n Member's name:"<<name;

cout<<"\n\n Address:"<<address;

cout<<"\n\n Contact no.:"<<phone;

int ret_mid()

return mid;

}
};

void line()

cout<<"\n";

for(int i=1; i<=40; i++)

cout<<"-";

void add_mem();

int search();

void edit();

void del();

void disp_mem();

//

void memberf()

char ch;

while(1)

cout<<"\n\n WELCOME TO MEMBER MANAGEMENT";

line();

cout<<"\n\n1.Add a member";

cout<<"\n\n2.Search a member";

cout<<"\n\n4.Delete a member";
cout<<"\n\n5.Show all members";

cout<<"\n\n0. Exit ";

cout<<"\n\n\n Your choice is: ";

ch=getch();

cout<<ch;

if(ch=='0')

break;

switch(ch)

case'1':add_mem();

break;

case'2':search();

break;

case'3':edit();

break;

case'4':del();

break;

case'5':disp_mem();

getch();

clrscr();

void add_mem()
{

member m;fstream file;

cout<<"\nEnter member details";

m.getmember();

file.open("member.dat",ios::app|ios::binary);

file.write((char*)&m,sizeof(m));

file.close();

int search()

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

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

cout<<"\n\n"<<cnt<<"members found";

void del()

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

if(found)

cout<<"\n\nRecord deleted";

else

cout<<"\n\nRecord not deleted";

class rent

int rid;

char dvdname[40];

char id;

date doi,dor;

float rent;

public:

void getrent(int mid)

id=mid;

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

cin>>rid;

cout<<"\n\nEnter dvd name";

gets(dvdname);

cout<<"\n\nDate of issue";

doi.getdate();

cout<<"\n\nDate of return";
dor.getdate();

cout<<"\n\nEnter rent";

cin>>rent;

void showrent()

cout<<"\n\nrent id no: ";

cout<<rid;

cout<<"\n\nDvd's name:";

cout<<dvdname;

cout<<"\n\ndate of issue:";

doi.showdate();

cout<<"\n\ndate ofreturn";

dor.showdate();

cout<<"\n\nRent:";

cout<<rent;

int ret_rid()

return rid;

};

void add_dvd()

{
rent r; fstream file;

int num;

num=search();

if(num!=-1)

cout<<"\n\nEnter details of dvd";

r.getrent(num);

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<<"Details of dvd are";

line();

while(file.read((char*)&r,sizeof(r)))

r.showrent();

cnt++;

}
file.close();

cout<<"\n\n"<<cnt<<"dvd found";

void dele()

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

line();

cout<<"\n\n1.Rent a dvd";

cout<<"\n\n2.Search a dvd";

cout<<"\n\n3.Return a dvd";

cout<<"\n\n4.Show all dvds";

cout<<"\n\n5.Member management";

cout<<"\n\n0.Exit ";

cout<<"\n\n\n Your choice is : ";

c=getch();

cout<<c;

if(c=='0')

break;
switch(c)

case'1':add_dvd();

break;

case'2':find();

break;

case'3':dele();

break;

case'4':disp_rent();

break;

case'5':memberf();

cout<<"\nPress any key to continue........";

getch();

clrscr();

Outputs

You might also like