Computer Project: Mohd. Amaan XII - 'C'
Computer Project: Mohd. Amaan XII - 'C'
PROJECT
BY:
MOHD. AMAAN
XII - 'C'
SUPER MARKET
BILLING SYSTEM
BY:
MOHD. AMAAN
XII - 'C'
CONTENTS
CERTIFICATE
ACKNOWLEDGEMENT
INTRODUCTION
PROGRAM CODE
PROGRAM OUTPUT
CERTIFICATE
This is to certify that Mohd. Amaan of class XII - C, D.P.S Mathura
Road, had prepared the Computer project on the topic SUPER
MARKET BILLING SYSTEM under my guidance and supervision
verified by Mrs. Anu Kumar.
ACKNOWLEDGEMENT
I TAKE THE OPPORTUNITY WITH IMMENSE
PLEASURE TO THANK MY COMPUTER TEACHER
MRS. ANU KUMAR WHO INSPIRED ME TO TAKE UP
THIS PROJECT ON THE TOPIC "SUPER MARKET
BILLING SYSTEM" AND ALSO GAVE ME EXPERT
GUIDANCE AND HELPED ME AT EVERY STEP.
BY:
MOHD. AMAAN
XII - 'C'
INTRODUCTION
The project title 'video library' is a programme which manages the
records of the movie CD's taken on rent by the customer of the
video library. It can be used by the owner of the store who can
rent a movie CD, return it.
Following are the features of the programme:
The owner can perform the following functions:
Create movie records.
Attach/Append movie records at the end of the movie
file.
Display movie records.
Insert a new movie record in the existing file.
Delete a movie record from the existing file.
Modify or make changes in an already existing movie
record.
The customer can perform the following functions:
Rent a movie CD.
Return the movie CD rented by him/her.
View the list of movie CD's.
Veiw the list of movie CD's along with the details.
SPECIAL FEATURES
The program is very interactive and user
friendly with proper indentation and layout.
Features like adding new movies records,
deleting them, or modifying them are only
accessible to the owner.
The customer can only access that part of the
program which includes functions like taking CD on
rent, returning it, viewing the list of various
available movie CD's etc.
Any change in the no. of movie CD's(taken on
rent or returned by the customer) is immediately
updated in therecords of the owner which he can
view at any time.
A contact card of the video store is also available to
the customer which can be used by them to
contact the video store.
PROGRAMME
CODE
/*
*************************************************************
PROJECT VIDEO LIBRARY
*************************************************************
*/
/* INCLUDE HEADER FILES */
#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include<process.h>
#include<stdlib.h>
#include<conio.h> // header file for getch().
class vlib
{
int movie_code;
char movie_title[60];
char director[60];
char actress[60];
float prices;
int no_of_copies;
int_no_issued;
public:
vlib()
{
no_issued=0;
}
void assign();
void input_for_modification();
void issue(char_m_name[60]);
void ret_cd(char m_name[60]);
char*get_moviename()
{
return movie_title;
};
//*****************************************
void vlib::assign()
{
cout<<"enter the movie code:";
cin>>movie_code;
cout<<"enter movie title:";
gets(movie_title);
cout<<"enter the director of the above movie";
gets(director);
cout<<"enter the actor of the above movie:";
gets(actor);
cout<<"enter the actress of the above movie:";
gets(actress);
cout<<"enter the no. of copies available:";
cin>>no_issued;
}
//*****************************************
void vlib::input_for_modification()
{
cout<<"enter the movie code:";
cin>>movie_code;
cout<<"enter movie title:";
gets(movie_title);
cout<<"enter the director of the above movie";
gets(director);
cout<<"enter the actor of the above movie:";
gets(actor);
cout<<"enter the actress of the above movie:";
gets(actress);
}
//*******************************************
void vlib::issue(char m_name[60])
{
char c;
do
{
cout<<"\nEnter the no of CD's of "<<m_name<<"you want to issue:\n";
cin>>no_issued;;
if((no_of_copies)>=(no_issued))
{
no_of_copies=no_issued;
cout<<no_issued<<"CD";
if(no_issued>1)
cout<<"s has been issued";
else
cout<<"has been issued";
cout<<"\n\n\n\t\t THANK YOU FOR VISITING OUR VIDEO LIBRARY!!!\n";
break;
}
else
{
cout<<"SORRY!!!\n";
cout<<"INSUFFICIENT NO. OF CD'S AVAILABLE IN THE LIBRARY!!\n";
cout<<"do you want less no. of CD's(y/n):";
cin>>ch;
}
}(while (ch=='y'|| ch=='Y'));
cout<<"\t\t PLEASE VISIT AGAIN!!\n";
}
//*****************************************
void vlib::ret-cd(char m_name[60])
{
int num;
cin>>num;
no_of_copirs+=num;
no_issued-=num;
cout<<"\n"<<num<<"CD";
if(num>1)
cout<<"s have been returned\n";
else
cout<<"has been returned\n";
cout<<"\n\n\n\t\t THANK YOU FOR VISITING OUR VIDEO LIBRARY!!\n";
cout<<"\t\t PLEASE VISIT AGAIN!!\n";
}
//*****************************************
void vlib::display_det()
{
cout<<"the movie code:"<<movie_code;
cout<<"\nMovie title:";
puts(movie_title);
cout<<"\n the director of the above movie:";
puts(director);
cout<<"\n the actor of the above movie: ";
puts(actor);
cout<<"\n the actress of the above movie:";
puts(actress);
}
//*******************************************
void vlib::display_list()
{
cout<<"\n";
cout<<" "<<movie_code<<"\t\t\t"<<"movie title";
}
//*******************************************
void vlib::disp_full_det()
{
cout<<"the movie code:"<<movie_code;
cout<<"\nMovie title:";
puts(movie_title);
cout<<"\n the director of the above movie:";
puts(director);
cout<<"\n the actor of the above movie: ";
puts(actor);
cout<<"\n the actress of the above movie:";
puts(actress);
cout<<"the no. of copies available:"<<no_of_copies;
cout<<"\nthe no. of copies issued:"<<no_issued<<"\n\n";
}
/*****************************************
/*function to create CD record*/
void createfile()
{ofstream fout("vlib.dat",ios::binary);
vlib v;
char ch;
do
{
cout<<"ENTER MOVIE RECORD:\n\n";
v.assign();
fout.write((char*)&v,size of(v));
cout<<"\n do you wish to enter more(y/n):";
cin>>ch;
cout<<"\n";
}while(ch=='y'||ch=='Y');
fout.close*(;
}
//**************************************
/*function to display movie CD details-for the owner*/
void display_full_details()
{
ifstream fin("vlib.dat, ios::binary);
vlib v;
fin.read((char*)&v,sizeof(v));
}
fin.close();
}
//************************************
/*function to append records*/
void append()
{
ofstream fout("vlib.dat",ios::app|ios::binary);
vlib v;
char ch;
do
{
cout<<"Enter movie record:\n";
v.assign();
fout.write((char*)&v,sizeof(v));
cout<<"\n Do you wish to enter more records(y/n):";
cin>>ch;
}while(ch=='y'||ch=='Y');
fout.close();
}
//************************************
/*function to insert a movie record*/
void insertion()
{
fstream file1,file2;
vlib v, vnew;
file1.open("vlib.dat",ios::binary|ios::in);
file2.open("vlibnew.dat",ios::binary|ios::out);
cout<<"enter new movie record to be inserted:\n\n";
vnew.assign();
int insert=0;
while(file1.read((char*)&v,sizeof(v)))
{
if(strcmpi(vnew.get_moviename(),v.get_moviename())<0&&(!insert))
{
file2.write((char*)&vnew,sizeof(vnew));
insert++;
}
file2.write((char*)&v,sizeof(v));
}
if(!insert)
file2.write((char*)&vnew,sizeof(vnew));
file1.close();
file2.close();
remove("vlib.dat");
rename("vlibnew.dat","vlib.dat");
}
/*************************************
/*function to delete a movie record*/
void deletion()
{
fstream file1, file2;
vlib v;
int code;
file1.open("vlib.dat",ios::binary|ios::in);
file2.open("vlibnew.dat",ios::binary|ios::out);
cout<<"\n enter the movie code whose record you want to delete:";
cin>>code;
int del=0;
while(file.read((char*)&v,sizeof(v));
{
if(v.get_code()!=code)
file2.write((char*)&v,sizeof(v));
else
del++;
}
if(!del)
cout<<"\n movie record not found\n";
else
cout<<"\n movie record deleted\n";
file1.close();
file2.close();
remove("vlib.dat");
rename("vlibnew.dat","vlib.dat");
}
//******************************************
/*function to modify an already existing file*/
void modify()
{
fstream file("vlib.dat",ios::in|ios::out|ios::binary);
vlib v;
int code;
cout<<"enter the movie code to modify that particular record/n";
cin>>code;
int found=0;
long pos=sizeof(vlib);
file.read((char*&v,sizeof(v)));
while(file&&(!found))
{
found++;
cout<<"new record\n";
v.input_for_modification();
file.seekp(-pos,ios::cur);
file.write((char*)&v,sizeof(v));
break;
}
file.read((char*)&v,sizeof(v));
}
if(!found)
cout<<"movie record not found for editing\n";
file.close;
}
//****************************************
/*function to display movie CD details-for the owner*/
void display_records()
{
ifstream fin(vlib.dat,ios::binary);
vlib v;
fin.read((char*)&v,sizeof(v));
while(fin)
{
v.display_det();
fin.read((char*)&v,sizeof(v));
}
fin.close;
}
//******************************************
/*function to display movie list*/
void display_list()
ifstream fin("vlib.dat",ios::binary);
vlib v;
cout<<"MOVIE CODE"<<"\t\t MOVIE NAME\n";
cout<<"----------"<<"\t\t------------\n";
while(fin.read((char*)&v,sizeof(v)))
{
//************************************
/*function to issue a CD from the list- for owner*/
void issue_CD()
{
fstream file("vlib.dat",ios::in|ios::out|ios::binary);
vlib v;
int code;
cout<<"\n enter the movie code, whose CD you want to issue on rent:\n ";
cin>>code;
int found=0;
char m_name[60];
long pos=sizeof(vlib);
file.read((char*)&v,sizeof(v));
while(file && !found)
{
if(v.get_code()==code)
{
found++;
strcpy(m_name,v.get_moviename());
v.issue(m_name);
file.seekp(-pos,ios::cur);
file.write((char*)&v,sizeof(v));
break;
}
file.read((char*)&v,sizeof(v));
}
if(found==0)
cout<<"wrong code entered\n";
file.close();
}
//************************************
/*function to return a CD back to library*/
void return_CD()
{
fstream file("vlib.dat",ios::in|ios::out|ios::binary);
vlib v;
int code;
cout<<"\n enter the movie code, whose CD you want to return back\n";
cin>>code;
int found=0;
char m_name[60];
long pos=sizeof(vlib);
file.read((char*)&v,sizeof(v));
while(file&&!found)
{
if(v.get_code()==code)
{
found++;
strcpy(m_name,v.get_moviename());
v.ret_CD(m_name);
file.seekp(-pos,ios::cur);
file.write((char*)&v,sizeof(v));
break;
}
file.read((char*)&v,sizeof(v));
}
if(found==0)
cout<<"Wrong code entered\n";
file.close();
}
//***********************************************
void main()
{
char ch,ch1,ch2,ch3,ch4, choice;
cout<<"\t\t*************************\n";
cout<<"\t\t*
MOVIE WORLD
*\n";
cout<<"\t\t*************************\n";
cout<<"\n\t The ULTIMATE place for all the movies lovers!!!\n\n\n";
do
{
cout<<"1:If you are a CUSTOMER... press 1\n";
cout<<"2:If you are the OWNER of the video store... press 2\n";
cout<<"3:To view to CONTACT CARD of the store... press 3\n";
cout<<"4:To EXIT FROM THE program... press 4\n";
ch=getch();
cout<<"\n\n";
switch(ch)
{
case '1':
do
{
cout<<"\n\n MOVIE MENU\n";
cout<<"--------------------------\n";
cout<<"1:View the list of movie CD's\n";
cout<<"2:View the list of the movie CD's along with the details\n";
cout<<"3:Rent a movie CD\n";
cout<<"4:Return a movie CD\n";
cout<<"5:Exit from the movie menu\n";
cout<<"\n\n Enter your choice(1-5):";
cin>>ch3;
switch(ch3)
{
case '1': cout<<"\t\t\t
cout<<"\t\t\t
display_list();
break;
case '2': cout<<"\t\t\t
cout<<"\t\t\t
display_records();
break;
case '3': cout<<"\t\t\t
--------------------\n\n";
display_list();
issue_CD();
break;
case '4': cout<<"\t\t\t
RETURNING A CD
\n ";
-------------------------
\n\n";
cout<<"\t\t\t
display_list();
return_CD();
break;
case '5': cout<<"\n\n\t\t
EXITING
\n";
break;
default: cout<<"WRONG CHOICE!! \n";
}
cout<<"\n Do you want to return to the MOVIE MENU again(y/n):";
cin>>ch4;
cout<<"\n";
}while(ch=='y'||ch=='Y');
break;
//****************************************
case '2': cout<<"\t\t*********************************\n";
cout<<"\t\t* WELCOME TO THE MOVIE WOLD *\n";
cout<<"\t\t**********************************\n\n";
do
{
cout<<"1: Create movie record\n";
cout<<"2: Append records at the end of the movie file\n ";
cout<<"3: Display movie records\n ";
}
cout<<"\n Do you want to return to the MOVIE MENU again(y/n):";
cin>>ch2;
cout<<"\n";
}while(ch2=='y'||ch2=='Y');
break;
case '3': cout<<"\n\t\t\t
cout<<"\t\t _______________________________\n\n";
cout<<"\t\t\t
MOVIE WORLD
\n";
lovers!! \n";
7838321219 \n";
}while(ch=='y'||ch=='Y');
cout<<"\t\t\t GOODBYE!! HAVE A NICE DAY!!! \n";
}
PROGRAMME
OUTPUT
*************************************
* MOVIE WORLD *
*************************************
The ULTIMATE place for all the movie lovers!!
*************************************
* WELCOME TO THE MOVIE WORLD *
*************************************
1:Create movie records.
2:Append records at the end of the movie file.
3:Display movie records.
4:Insert a new movie record in the existing file
5:Delete a movie record from an existing file
6:Modify an already existing movie record.
7:Exit from the menu.
MOVIE MENU
_______________________________
The movie code:101
Enter movie title: Kurbaan
Enter the director of the above movie: Karan Johar
Enter the actor of the above movie: Saif Ali Khan
Enter the actress of the above movie: Kareena Kapoor Khan
Enter the no. of copies available:10
Enter the no. of copies issued:3
Enter the movie code whose record you want to delete: 103
MOVIE MENU
*******************
MOVIE WORLD
*******************
The ULTIMATE place for all the movie lovers!!!
MOVIE MENU
MOVIE LIST
MOVIE CODE
MOVIE NAME
110
102
105
MOVIE MENU
1: View the list of movies cds
2: View the list of movie cds along with the details
3: Rent a movie cd
4: Return a movie cd
5: Exit from the movie menu
MOVIE DETAILS
MOVIE MENU
1: View the list of movies cds
MOVIE CODE
MOVIE NAME
110
102
105
Enter the movie code, whose cd you want to issue on rent: 102
Enter the no. of CDs of Twilight you want to issue: 5
5 CDs have been issued
MOVIE MENU
1: View the list of movies cds
2: View the list of movie cds along with the details
3:Rent a movie cd
4: Return a movie cd
5: Exit from the movie menu
MOVIE CODE
MOVIE NAME
110
102
105
Enter the movie code, whose cd you want to issue on rent: 110
Enter the no. of CDs of Twilight you want to issue: 11
SORRY!!
INSUFFICIENT NO. OF CDS AVAILABLE IN THE LIBRARY
Do you want less no. of CDs (y/n)? : y
Enter the no. of CDs of The Guardians of the Galaxy you want to issue: 2
2 CDs have been issued.
RETURNING A MOVIE CD
MOVIE CODE
MOVIE NAME
110
102
105
Enter the movie code, whose CD you want to return back: 102
Enter the no. of CDs of Twilight you want to return: 5
5 CDs have been returned.
MOVIE MENU
1: View the list of movies cds
2: View the list of movie cds along with the details
3: Rent a movie cd
4: Return a movie cd
5: Exit from the movie menu
RETURNING A MOVIE CD
MOVIE CODE
110
102
105
MOVIE NAME
Enter the movie code, whose CD you want to return back: 110
Enter the no. of CDs of The Guardians of the Galaxy you want to return: 6
6 CDs have been returned.
MOVIE MENU
1: View the list of movies cds
2: View the list of movie cds along with the details
3: Rent a movie cd
4: Return a movie cd
5: Exit from the movie menu
Enter your choice (1-5): 5
EXITING!!!!!!!!
*******************
MOVIE WORLD
*******************
CONTACT CARD
MOVIE WORLD
The ULTIMATE place for all the movie lovers !!
DVDS/VCDS on rent at very demandable prices !
ADDRESS: 326 New Friends Colony, New Delhi-110024
CONTACT NO. 24513652,21543265,6476776402
*FREE HOME DELIVERY upto2 KM radius*