Professional Documents
Culture Documents
Movie Planet
Movie Planet
Major Project
Bachelor of Science
In
Information Technology
By
Samarth Vip
Enroll. No. A50504914032
Declaration
Signature(s)
Samarth Vip
Enroll No.: A50504914032
Department of Information Technology
Amity Institute of Information Technology
Certificate
This is to certify that the work in the project report entitled “Movie Planet” by Samarth
Vip bearing Enroll. No. A50504914032 is a bonafide record of project work carried out
by him under my supervision and guidance in partial fulfillment of the requirements for
the award of the degree of Bachelor of Science (Information Technology) in the
Department of Information Technology, Amity Institute of Information Technology,
Amity University Haryana, Gurgaon. Neither this project nor any part of it has been
submitted for any degree or academic award elsewhere.
Signature of Supervisor(s)
Head
Department of Information Technology
Amity Institute of Information Technology
Amity University Haryana, Gurgaon
CONTENTS
TITLE PAGE NO.
CHAPTER 1: INTRODUCTION 1
CHAPTER 5: IMPLEMENTATION 18
CHAPTER 7: CODING 57
REFERENCES 112
CHAPTER 1
INTRODUCTION
This project facilitates keeping records of CDs and customers in a systematic and easily
accessible manner with hundred percent accuracy .It also show all CDs and customers
listing whenever needed.
Efficiency wise the software makes efficient use of system resources such as memory.
The accuracy of the system is up to the mark. It can also be used by the customer to get
all updated collection information from the video parlor.
All CDs and customer records are updated with each transaction to keep the
system up to date.
All CDs and customers are having a unique id by which they are recognized.
Fine is charged after skipping the date of return of the CD by the customer at the
rate of Rs.2 per day.
This software automates almost all the activities of the video parlor that
could be automated. It provides a conducive environment to the person
working there. It has made work simpler and easier. Now one can work more
efficiently and with more interest without wasting much of his/her time.
1
1.2 DEFINITION OF THE PROBLEM
At present all the activities of the video parlors like adding, modifying and deletion of
new CDs and customers were done manually. Cumulative information like total copies of
a particular CD are also maintained manually in the registers for the transactions being
made.
Since the existing system is manual one, the owner has to face many difficulties
everyday. Some of the difficulties are as follows-
Computerization helps us address these problems. Stated below are some of the
advantages using computers instead of manual work-
It has provision of allowing only authentic users having access to database. So the
problem of security is dealt with.
There is no need of large amount of stationary paper as all the data is entered into
the computer.
2
List generation of CDs also becomes very easier as there is no need for any
manual paper work.
3
CHAPTER 2
The various issues that were brought to light to light! Inventory System for New Era-CD
Library Shop beggar in for a computerized sales monitoring system to increase the
efficiency of the operation department, first of all. Complete details about the customer
must be maintained. This will left up to know how much is due from any given credit
customer and when his credit period expires for the last purpose apart from this complete
details abort product are also to be maintained. This will help identify the product, which
are low in collection and objectives to be meet; we need to record for these objectives to
be meet. We need to record all the transaction and also update the and product various
tasks can be looked and below:-
9. Report on Credit
4
CHAPTER 3
TECHNOLOGY USED
APPLICATION OF C++
a. C++ is a versatile language for handling very large programs. It is suitable
for virtually any programming task including development of editors, compilers,
database communication systems and any real life application systems.
b. Since, C++ allows us to create hierarchy related objects, we can build
special object oriented libraries which can be used later by many programmers.
5
1. A good package can get the system running quickly.
2. MIS personnel are released for other projects.
3. 'Home-grown' software can take more time and its cost cannot be predicted.
4. Package can be tested before purchasing it.
It can be observed that price alone cannot determine the quality of software. A systematic
review is crucial for selecting the desired software. Prior to selecting the software, the
project team must set up criteria for selection.
6
CHAPTER 4
DESIGN OF THE PROJECT
Software:-
Windows XP
C++ (Turbo C++)
USER REQUIREMENT
Users for their assistance in running the project successfully must have following
necessities.
1. Fundamental knowledge of basic computer operations.
2. User must read the user manual supplied with the project.
3. Users must not try and run the project below the specified conditions.
DATA DICTIONARY
A data dictionary is a catalog – a repository – of the elements in a system. As the
name suggests, these elements center around data and the way they are structured to meet
the user requirements and organization needs. In a data dictionary, you will find a list of
all the elements composing the data flowing through a system. The major elements are
data flows, data stores and processes. The data dictionary stores details and descriptions
of these elements.
7
-DATA FLOW DIAGRAM’S-
Data Flow Diagrams provide a logical model of the system and show the flow of logic
involved in the proposed\present system.
CUSTOMER
CD’S PAYMENTS
Movie
Planet
DETAILS
OWNER
8
-TOP LEVEL D.F.D -
1.Introduction
7.Exit
CD.DAT
Customer.dat
Details
About6.Edit Records 2.Add CD to collection
Exit the s/w
New cd
Data
Customers
list
Details
5.Return CD
Details Update
CD.DAT
9
DFD FOR ADDITION OF NEW CD
Owner CD.dat
Input details
If O.K
1.validation checks
If not O.K
Error message
New record
2. Updatefiles
10
DFD FOR ADDITION OF NEW CUSTOMER
Owner Customer.dat
Input
details If O.K
1.Validation checks
If not O.K
Error message
New record
2.Update files
11
DFD FOR ISSUE A CD
1. Data processed
Amount Update record
12
DFD FOR CD RETURN
Movie planet
Fine Update record
13
-D.F.D FOR CD CATALOG-
1.
Enter
Suitable
Choice
processing
2.
detail
open CD.dat
file CD.dat
processing
3.
display
information
14
-D.F.D FOR CUSTOMERS CATALOG-
1.
Enter
suitable
choice
processing
2.
detail
open customer.dat
customer.dat
processing
3.
display
information
15
-D.F.D FOR DELETION OF CD RECORD-
2.
1. accepts
Owner Request for DISPLAY & check
deletion LIST. record
details
verification
CD.dat
details
update
3.
prompts
CD.dat to delete
update
16
-D.F.D FOR DELETION OF CUSTOMER -
2.
1. accepts
Owner Request for DISPLAY & check
deletion LIST. record
details
verification
customer.dat
details
update
3.
prompts
customer.dat to delete
update
17
CHAPTER 5
IMPLEMENTATION
-FLOW CHART-
START
1.INTRODUCTION
2.ADD CD TO COLLECTION
3.ADD A CUSTOMER
4.ISSUE A CD
5.RETURN CD
6.CD CATALOG
7.CUSTOMERS CATALOG
8.EDIT
0.EXIT
READ CH(CH)
YES
introduction()
IFCH=
1
YES add_cd()
IF
CH=2
YES add_member()
IF
CH=3
YES
issuecd()
IF
CH=4
YES
returncd()
IF
CH=5
18
C
C
YES
IF CH=6 list()
YES
IF CH=7 list()
YES
IF CH=8 edit_menu()
NO YES
A IF CH=0 STOP
19
-MENU DESIGNS-
MAIN MENU:
INTRODUCTION
OWNER
ADD CD TO
COLLECTION
ADD CUSTOMER
ISSUE CD
RETURN CD
CD CATALOG
CUSTOMER
CATALOG
EDIT
EXIT
EDIT CUSTOMER
RECORD
EXIT
DELETE CD RECORD
EXIT
22
EDIT CUSTOMER RECORD MENU
DELETE CUSTOMER
RECORD
EXIT
23
-DATA DICTIONARY-
class MENU :- THIS CLASS CONTROL ALL THE FUNCTIONS IN THE MENU
{
public :
void main_menu(void) ; TO SHOW MAIN MENU
void introduction(void) ; TO SHOW INTRO MENU
private :
void edit_menu(void) ; TO SHOW EDIT MENU
void edit_cd(void) ; TO SHOW EDIT CD MENU
void edit_member(void) ; TO SHOW EDIT CUSTOMER
MENU
};
int recordno(int) ;
int available(int) ; TO CHECK CD’S AVALAIBILITY
char *year(int) ;
float cdprice(int) ; FOR CD PRICE
int no_of_copies(int) ;FOR NO. OF COPIES
int cdcodeof(char[]) ; FOR CD CODE
void display(int) ; FOR DISPLAY REC
int reccount(void) ;
void delete_rec(int) ; FOR DELETION OF REC
private :
24
char name[33], copyright[26] ;
float price ;
int avail ;
};
class CUSTOMER
{
public :
void list(void) ; FOR CD CATALOG
int cdcode;
CUSTOMER(){cdcode=0;}
protected :
void add_mem(int, int, char [], char [], char[], int, int,int);
25
CUSTOMER THIS IS DERIVED FROM CLASS CD & CUSTOMER AND
CONTAINS FUNCTIONS FOR WORKING (ISSUE,RETURN,ETC).
class WORKING : public CD, public
{
public :
void issuecd(void) ;
void returncd(void) ;
void add_cd(void) ;
void add_member(void) ;
void modify_cd(void) ;
void modify_member(void) ;
void delete_cd(void) ;
void delete_member(void) ;
};
class DATE
{
public :
void extend_date(int,int,int,int) ;
int diff(int, int, int, int, int, int) ;
int day, mon, year ;
};
26
-HEADER FILES USED-
IOSTREAM.H Declares the basic C++ (version 2.0) streams (I/O) routines.
PROCESS.H Contains structures and declarations for the spawn... and exec...
functions.
STDLIB.H Declares several commonly used routines: conversion routines,
search/sort routines, and other miscellany.
STDIO.H Defines types and macros needed for the Standard I/O Package.
Defines the standard I/O predefined streams stdin, stdout, stdprn,
and stderr, and declares stream-level I/O routines.
CTYPE.H Contains information used by the character classification and
character conversion macros
CONIO.H Declares various functions used in calling the DOS console I/O
routines.
DOS.H Defines various constants and gives declarations needed for DOS
calls.
STRING.H Declares several string- and memory-manipulation routines
FSTREAM.H Declares the C++ stream classes that support file input and output
27
CHAPTER 6
SCREEN SHOTS
-INTRODUCTION SCREEN-
______________________________________________
W E L C O M E T O T H E M O V I E P LAN E T
______________________________________________
28
MAIN MENU
_______________________________________________
M O V I E S P LAN E T
_______________________________________________
1. INTRODUCTION
2. ADD CD TO COLLECTION
3. ADD A CUSTOMER
4. ISSUE A CD
5. RETURN CD
6. CDs CATALOG
7. CUSTOMERS CATALOG
8. EDIT RECORDS
0. EXIT
_______________________________________________
29
ADDITION OF CD’S MENU
EXIT (0)
CD NAME : DHOOM
COPYRIGHT: HMV
PRICE : Rs.200
COPIES :5
30
ADDITION OF CUSTOMERS MENU
EXIT (0)
_____________________________________________________________________
CUSTOMER CODE : 1
_____________________________________________________________________
NAME : smarth
PHONE : 23655043
31
ISSUE A CD MENU
EXIT (0)
DATE : 11/9/2004
32
CD ISSUED MENU
33
Exit (0)
DATE : 11/9/2004
CD NAME: DHOOM
CD ISSUED TO JYOTI
RETURN A CD MENU
34
EXIT (0)
DATE : 11/9/2004
35
CD RETURNED MENU
EXIT (0)
DATE : 11/9/2004
CD NAME : DHOOM
CUSTOMER: JYOTI
CD RETURNED!!
36
CD’S CATALOG MENU
LIST OF CD's
____________________________________________________________________________
37
CUSTOMERS CATALOG MENU
LIST OF CUSTOMERS
______________________________________________________________________________
38
EDIT RECORD MENU
_____________________________________________________________________
EDIT MENU
_____________________________________________________________________
1. EDIT CD RECORDS
2. EDIT CUSTOMER RECORDS
0. EXIT
_____________________________________________________________________
39
EDIT CD RECORD MENU
_____________________________________________________________________
EDIT CD RECORD
_____________________________________________________________________
1. MODIFY A RECORD
2. DELETE A RECORD
0. EXIT
_____________________________________________________________________
40
MODIFY CD RECORD MENU
EXIT (0)
CD CODE #: 1
CD NAME : DHOOM
COPYRIGHT : HMV
PRICE : Rs.100
COPIES :5
COPIES AT PRESENT : 5
CD NAME :
COPYRIGHT :
PRICE : Rs.
41
DELETE CD RECORD MENU
EXIT (0)
CD CODE #: 1
CD NAME : DHOOM
COPYRIGHT : HMV
PRICE : Rs.100
COPIES :5
COPIES AT PRESENT : 5
42
EDIT CUSTOMERS RECORD MENU
______________________________________________________________________
______________________________________________________________________
43
MODIFY CUSTOMERS RECORD MENU
EXIT (0)
CUSTOMER CODE : 1
_____________________________________________________________________
NAME : JYOTI
PHONE : 23642496
ADDRESS : SHASTRI NAGAR
NAME :
PHONE :
ADDRESS :
44
DELETE CUSTOMERS RECORD MENU
EXIT (0)
CUSTOMER CODE : 2
___________________________________________________________________
NAME : SMARTH
PHONE : 23655043
ADDRESS : B-150,SUBHADRA COLONY
RECORD MODIFIED!!
45
PRINT REPORTS
CD’S CATALOG MENU
LIST OF CD's
____________________________________________________________________________
46
CUSTOMERS CATALOG MENU
LIST OF CUSTOMERS
___________________________________________________________________________
47
TEST SCREENS
SCREEN GENERATED IF WRONG CD CODE IS ENTERD
EXIT (0)
DATE : 11/9/2004
NO SUCH RECORDS
PRESS <ESC> TO EXIT OR ANY OTHER KEY TO CONT...
48
SREEN GENERATED WHEN WRONG CUSTOMER CODE IS
ENTERED
Exit (0)
DATE : 11/9/2004
CD NAME: DHOOM
NO SUCH RECORDS
PRESS <ESC> TO EXIT OR ANY OTHER KEY TO CONT...
49
50
SCREEN GENERATED WHEN PRICE IS ENTERED IN ALPHABETS
EXIT (0)
CD NAME : MURDER
COPYRIGHT:HMV
PRICE : Rs.DDD
COPIES :
51
SCREEN GENERATED WHEN COPIES IS ENTERED IN
APLPHABETS
EXIT (0)
CD NAME :MURDER
COPYRIGHT:HMV
PRICE : Rs.200
COPIES :D
52
SCREEN GENERATED WHEN CUSTOMER’S NAME IS ENTERED
IN NUMERICS
EXIT (0)
_________________________________________________________________________
CUSTOMER CODE : 1
_________________________________________________________________________
NAME : 123
PHONE :
ADDRESS :
53
SCREEN GENERATED WHEN TELEPHONE NO. IS ENTERED IN
ALPHABETS
EXIT (0)
_____________________________________________________________________
CUSTOMER CODE : 1
_____________________________________________________________________
NAME : SMARTH
PHONE : ASDF
ADDRESS :
54
SCREEN GENERATED WHEN ADDRESS IS NOT ENTERED
EXIT (0)
___________________________________________________________________
CUSTOMER CODE : 1
___________________________________________________________________
NAME : SMARTH
PHONE :
ADDRESS :
55
SCREEN GENERATED WHEN CUSTOMER IS HAVING NO CD AND
HIS CODE IS ENTERED TO RETURN A CD
EXIT (0)
DATE : 11/9/2004
56
SCREEN GENERATED WHEN PRICE IS ENTERED IN ALPHABETS
DURING MODIFICATION
EXIT (0)
CD CODE #: 1
CD NAME : DHOOM
COPYRIGHT : HMV
PRICE : Rs.100
COPIES :5
COPIES AT PRESENT : 3
CD NAME : DHOOM
COPYRIGHT : SONY
PRICE : Rs. ASD
57
SCREEN GENERATED WHEN A CODE IS ENTERED FOR
DELETING A CD RECORD WHICH IS NOT PRESENT
EXIT (0)
NO SUCH RECORDS
PRESS <ESC> TO EXIT OR ANY OTHER KEY TO CONT...
58
CHAPTER 7
CODING
//**********************************************************
// MOVIES PLANET
//**********************************************************
//**********************************************************
// INCLUDED HEADER FILES
//**********************************************************
#include <iostream.h>
#include <fstream.h>
#include <process.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <dos.h>
//**********************************************************
// THIS CLASS CONTROL ALL THE FUNCTIONS IN THE MENU
//**********************************************************
class MENU
{
public :
void main_menu(void) ;
void introduction(void) ;
private :
void edit_menu(void) ;
void edit_cd(void) ;
void edit_member(void) ;
};
//**********************************************************
// THIS CLASS CONTAINS FUNCTIONS RELATED TO CD's
//**********************************************************
class CD
59
{
public :
int cdcode, copies ;
void list(void) ;
char *cdname(int) ;
protected :
void add_new_cd(int, char tname[33], char tcopyright[26],
float, int, int) ;
void update_copies(int, int, int) ;
void modify(int, char[], char[], float) ;
void deletion(void) ;
int cd_found(int) ;
int cdname_found(char []) ;
int recordno(int) ;
int available(int) ;
char *year(int) ;
float cdprice(int) ;
int no_of_copies(int) ;
int cdcodeof(char[]) ;
void display(int) ;
int reccount(void) ;
void delete_rec(int) ;
private :
};
//**********************************************************
// THIS CLASS CONTAINS FUNCTIONS RELATED TO CUSTOMERS
//**********************************************************
class CUSTOMER
{
public :
void list(void) ;
int cdcode;
CUSTOMER(){cdcode=0;}
protected :
void add_mem(int, int, char [], char [], char[], int, int, int) ;
void modify(int, char[], char[], char[]) ;
void deletion(void) ;
int member_found(int) ;
60
void update_cd(int, int, int, int, int) ;
char *membername(int) ;
char *memberphone(int) ;
char *memberaddress(int) ;
int recordno(int) ;
int lastcode(void) ;
int issued(int) ;
int fine(int) ;
void display(int) ;
void delete_rec(int) ;
private :
int memcode ;
char name[26], phone[10], address[50] ;
int dd, mm, yy ; // DATE OF RETURNING THE CD //
};
//**********************************************************
// THIS IS DERIVED FROM CLASS CD & CUSTOMER AND CONTAINS
// FUNCTIONS FOR WORKING (ISSUE,RETURN,ETC).
//**********************************************************
//**********************************************************
// THIS CLASS CONTAINS FUNCTIONS RELATED DATE & FINE
//**********************************************************
class DATE
{
public :
void extend_date(int,int,int,int) ;
int diff(int, int, int, int, int, int) ;
int day, mon, year ;
61
};
//**********************************************************
// FUNCTION TO EXTEND GIVEN DATE BY 15 DAYS
//**********************************************************
void DATE :: extend_date(int d1, int m1, int y1, int days)
{
static int month[] = {31,29,31,30,31,30,31,31,30,31,30,31} ;
for (int i=1; i<=days; i++)
{
d1++ ;
if ((d1 > month[m1-1]) || (y1%4 != 0 && m1 == 2 && d1 >
28))
{
d1 = 1 ;
m1++ ;
}
if (m1 > 12)
{
m1 = 1 ;
y1++ ;
}
}
day = d1 ;
mon = m1 ;
year = y1 ;
}
//**********************************************************
// THIS FUNCTION RETURN THE DIFFERENCE BETWEEN TWO GIVEN
// DATES
//**********************************************************
int DATE :: diff(int d1, int m1, int y1, int d2, int m2, int y2)
{
int days = 0 ;
if ((y2<y1) || (y2==y1 && m2<m1) || (y2==y1 && m2==m1
&& d2<d1))
return days ;
static int month[] = {31,29,31,30,31,30,31,31,30,31,30,31} ;
while (d1 != d2 || m1 != m2 || y1 != y2)
{
62
days++ ;
d1++ ;
if ((d1 > month[m1-1]) || (y1%4 != 0 && m1 == 2 && d1 >
28))
{
d1 = 1 ;
m1++ ;
}
if (m1 > 12)
{
m1 = 1 ;
y1++ ;
}
}
return days ;
}
//**********************************************************
// FUNCTION TO DISPLAY MAIN MENU & CONTROL ALL THE FUNCTION
// IN THE MAIN MENU.
//**********************************************************
char ch ;
while (1)
{
clrscr() ;
gotoxy(1,4);
cout
<<"____________________________________________________________________
____________" ;
gotoxy(29,6) ;
cout<<"M O V I E S P L A N E T" ;
gotoxy(1,7) ;
cout
<<"____________________________________________________________________
____________" ;
gotoxy(30,10) ;
cout <<"1. INTRODUCTION" ;
gotoxy(30,11) ;
cout <<"2. ADD CD TO COLLECTION" ;
gotoxy(30,12) ;
cout <<"3. ADD A CUSTOMER" ;
63
gotoxy(30,13) ;
cout <<"4. ISSUE A CD" ;
gotoxy(30,14) ;
cout <<"5. RETURN CD" ;
gotoxy(30,15) ;
cout <<"6. CDs CATALOG " ;
gotoxy(30,16) ;
cout <<"7. CUSTOMERS CATALOG" ;
gotoxy(30,17) ;
cout <<"8. EDIT RECORDS" ;
gotoxy(30,18) ;
cout <<"0. EXIT" ;
gotoxy(1,20) ;
cout
<<"____________________________________________________________________
____________" ;
gotoxy(30,22);
cout <<"ENTER A SUITABLE CHOICE" ;
ch = getche() ;
if (ch == 27)
break ;
else
if (ch == '1')
introduction() ;
else
if (ch == '2')
{
WORKING W ;
W.add_cd() ;
}
else
if (ch == '3')
{
WORKING W ;
W.add_member() ;
}
else
if (ch == '4')
{
WORKING W ;
W.issuecd() ;
}
else
if (ch == '5')
{
WORKING W ;
64
W.returncd() ;
}
else
if (ch == '6')
{
CD B ;
B.list() ;
}
else
if (ch == '7')
{
CUSTOMER M ;
M.list() ;
}
else
if (ch == '8')
edit_menu() ;
else
if (ch == '0')
break ;
}
}
//**********************************************************
// FUNCTION TO DISPLAY EDIT MENU
//**********************************************************
char ch ;
while (1)
{
clrscr() ;
gotoxy(1,7);
cout
<<"____________________________________________________________________
____________" ;
gotoxy(32,9) ;
cout <<"E D I T M E N U";
gotoxy(1,10) ;
cout
<<"____________________________________________________________________
____________" ;
65
gotoxy(32,13) ;
cout <<"1. EDIT CD RECORDS" ;
gotoxy(32,14) ;
cout <<"2. EDIT CUSTOMER RECORDS";
gotoxy(32,15) ;
cout <<"0. EXIT" ;
gotoxy(1,17) ;
cout
<<"____________________________________________________________________
____________" ;
gotoxy(31,20);
cout <<"PLEASE ENTER A SUITABLE CHOICE : " ;
ch = getche() ;
if (ch == 27)
break ;
else
if (ch =='1')
edit_cd() ;
else
if (ch == '2')
edit_member() ;
else
if (ch == '0')
break ;
}
}
//**********************************************************
// FUNCTION TO DISPLAY EDIT MENU FOR CD & CONTROL
// ALL THE FUNCTION IN THE EDIT MENU.
//**********************************************************
char ch ;
while (1)
{
clrscr() ;
gotoxy(1,8) ;
cout
<<"____________________________________________________________________
____________" ;
gotoxy(31,9) ;
cout <<"E D I T C D R E C O R D";
66
gotoxy(1,10) ;
cout
<<"____________________________________________________________________
____________" ;
gotoxy(34,13) ;
cout <<"1. MODIFY A RECORD" ;
gotoxy(34,14) ;
cout <<"2. DELETE A RECORD" ;
gotoxy(34,15) ;
cout <<"0. EXIT" ;
gotoxy(1,17) ;
cout
<<"____________________________________________________________________
____________" ;
gotoxy(31,20) ;
cout <<"ENTER A SUITABLE CHOICE : " ;
ch = getche() ;
if (ch == 27)
break ;
else
if (ch == '1')
{
WORKING W ;
W.modify_cd() ;
}
else
if (ch == '2')
{
WORKING W ;
W.delete_cd() ;
}
else
if (ch == '0')
break ;
}
}
//**********************************************************
// FUNCTION TO DISPLAY EDIT MENU FOR CUSTOMERS & CONTROL
// ALL THE FUNCTION IN THE EDIT MENU.
//**********************************************************
68
//**********************************************************
// FUNCTION TO DISPLAY THE INTRODUCTION FOR THE PROJECT.
//**********************************************************
gotoxy(5,10) ;
cout <<"* THIS PROJECT WILL FACILITATE KEEPING
RECORDS OF CD'S AND CUSTOMERS";
gotoxy(16,11);
cout<<" IN A SYSTEMATIC AND EASILY ACCESSIBLE
MANNER " ;
gotoxy(5,13);
cout<<"* CHARGES FINE AFTER SKIPPING THE DATE OF
RETURN @ OF Rs.2 PER DAY";
gotoxy(5,15);
cout<<"* LISTS CDs AND CUSTOMERS RECORDS";
gotoxy(24,24) ;
cprintf("PRESS ANY KEY TO RUN THE PROJECT") ;
textcolor(LIGHTGRAY) ;
getch() ;
}
//**********************************************************
// THIS FUNCTION RETURN 0 IF GIVEN CD CODE NOT FOUND
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURN 0 IF GIVEN CD NAME NOT FOUND
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURN RECORD NO. FOR THE CD CODE
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURNS THE AVAILABLE COPIES FOR THE GIVEN
// CD CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURNS THE NO. OF COPIES FOR THE GIVEN
// CD CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURNS THE CD NAME OF THE GIVEN CD
// CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURNS THE COPYRIGHT NAME OF THE GIVEN CD
// CODE.
//**********************************************************
72
char *CD :: year(int tcode)
{
fstream file ;
file.open("CD.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
char tcopyright[26] ;
while (file.read((char *) this, sizeof(CD)))
{
if (cdcode == tcode)
{
strcpy(tcopyright,copyright) ;
break ;
}
}
file.close() ;
return tcopyright ;
}
//**********************************************************
// THIS FUNCTION RETURNS THE CD PRICE OF THE GIVEN CD
// CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURNS THE CD CODE OF THE GIVEN CD
// NAME.
73
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURNS THE NO. OF THE RECORDS IN THE CD
// FILE.
//**********************************************************
int CD :: reccount(void)
{
fstream file ;
file.open("CD.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
int count=0 ;
while (file.read((char *) this, sizeof(CD)))
count++ ;
file.close() ;
return count ;
}
//**********************************************************
// THIS FUNCTION DELETES THE RECORD OF THE GIVEN CD CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION ADD THE RECORD IN THE CD FILE
//**********************************************************
//**********************************************************
// THIS FUNCTION UPDATE THE RECORD IN THE CD FILE FOR THE
// GIVEN CD CODE
//**********************************************************
//**********************************************************
// THIS FUNCTION MODIFY THE RECORD IN THE CD FILE FOR THE
// GIVEN CD CODE
//**********************************************************
76
//**********************************************************
// THIS FUNCTION DISPLAY THE RECORD FROM THE CD FILE
// FOR THE GIVEN CD CODE
//**********************************************************
//**********************************************************
// THIS FUNCTION DISPLAY THE LIST OF CD's.
//**********************************************************
void CD :: list(void)
{
clrscr() ;
int row = 11 , found=0, flag=0 ;
char ch ;
gotoxy(33,4) ;
cout <<"LIST OF CD's" ;
gotoxy(1,5) ;
77
cout
<<"____________________________________________________________________
____________" ;
gotoxy(2,7) ;
cout <<"CODE CD NAME COPYRIGHT
PRICE COPIES" ;
gotoxy(1,8) ;
cout
<<"____________________________________________________________________
____________" ;
fstream file ;
file.open("CD.DAT", ios::in) ;
file.seekg(0,ios::beg) ;
while (file.read((char *) this, sizeof(CD)))
{
flag = 0 ;
delay(20) ;
found = 1 ;
gotoxy(2,row) ;
cout <<cdcode ;
gotoxy(7,row) ;
cout <<name ;
gotoxy(40,row) ;
cout <<copyright ;
gotoxy(66,row) ;
cout <<price ;
gotoxy(73,row) ;
cout <<copies ;
gotoxy(40,row+1) ;
cprintf("STATUS: ") ;
cprintf("%d COPIES AVAILABLE",avail) ;
if ( row == 22 )
{
flag = 1 ;
row = 6 ;
gotoxy(1,25) ;
cout <<"PRESS ANY KEY TO CONT.. OR <ESC> TO
EXIT" ;
ch = getch() ;
if (ch == 27)
break ;
clrscr() ;
gotoxy(33,2) ;
cout <<"LIST OF CD's" ;
gotoxy(1,3) ;
78
cout
<<"____________________________________________________________________
____________" ;
gotoxy(1,4) ;
cout <<"CODE CD NAME COPYRIGHT
PRICE COPIES" ;
gotoxy(1,5) ;
cout
<<"____________________________________________________________________
____________" ;
}
else
row = row + 2 ;
}
if (!found)
{
gotoxy(5,10) ;
cout <<"\7NO RECORDS" ;
}
if (!flag)
{
gotoxy(1,25) ;
cout <<"PRESS ANY KEY TO CONT..." ;
getche() ;
}
file.close () ;
}
//**********************************************************
// THIS FUNCTION RETURN 0 IF THE GIVEN CUSTOMER CODE NOT FOUND
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURN 0 IF THE CUSTOMER HAVE NOT ISSUED ANY
// CD.
//**********************************************************
//**********************************************************
// THIS FUNCTION CALCULATE AND RETURN FINE FOR THE GIVEN
// CUSTOMER CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURN THE LAST CODE OF THE CUSTOMER FILE.
//**********************************************************
file.close() ;
return mcode ;
}
//**********************************************************
// THIS FUNCTION RETURNS CUSTOMER NAME OF THE GIVEN CUSTOMER
// CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURNS CUSTOMER PHONE OF THE GIVEN CUSTOMER
// CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURNS CUSTOMER ADDRESS OF THE GIVEN
CUSTOMER
// CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION RETURNS RECORD NO. OF THE GIVEN CUSTOMER
// CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION DELETE RECORD FOR THE GIVEN CUSTOMER CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION UPDATE RECORD FOR THE GIVEN CUSTOMER CODE.
//**********************************************************
void CUSTOMER :: update_cd(int mcode, int tcode, int d1, int m1, int y1)
{
fstream file ;
file.open("CUSTOMER.DAT", ios::in) ;
fstream temp ;
temp.open("temp.dat", ios::out) ;
file.seekg(0,ios::beg) ;
while ( !file.eof() )
{
file.read((char *) this, sizeof(CUSTOMER)) ;
if ( file.eof() )
break ;
if ( memcode == mcode )
{
84
cdcode = tcode ;
dd = d1 ;
mm = m1 ;
yy = y1 ;
temp.write((char *) this, sizeof(CUSTOMER)) ;
}
else
temp.write((char *) this, sizeof(CUSTOMER)) ;
}
file.close() ;
temp.close() ;
file.open("CUSTOMER.DAT", ios::out) ;
temp.open("temp.dat", ios::in) ;
temp.seekg(0,ios::beg) ;
while ( !temp.eof() )
{
temp.read((char *) this, sizeof(CUSTOMER)) ;
if ( temp.eof() )
break ;
file.write((char *) this, sizeof(CUSTOMER)) ;
}
file.close() ;
temp.close() ;
}
//**********************************************************
// THIS FUNCTION MODIFY RECORD FOR THE GIVEN CUSTOMER CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION DISPLAY THE RECORD FOR THE GIVEN CUSTOMER
// CODE.
//**********************************************************
//**********************************************************
// THIS FUNCTION DISPLAY THE LIST OF THE CUSTOMERS
//**********************************************************
if ( row == 22 )
{
flag = 1 ;
row = 6 ;
gotoxy(1,25) ;
cout <<"PRESS <ESC> TO EXIT OR ANY OTHER KEY
TO CONT..." ;
ch = getch() ;
if (ch == 27)
break ;
clrscr() ;
gotoxy(32,2) ;
cout <<"LIST OF CUSTOMERS" ;
gotoxy(1,3) ;
cout
<<"_______________________________________________________________" ;
gotoxy(1,4) ;
cout <<"CODE NAME PHONE" ;
gotoxy(1,5) ;
cout
<<"_______________________________________________________________" ;
}
else
row = row + 2 ;
}
if (!found)
{
gotoxy(15,20) ;
88
cout <<"\7 NO RECORDS TO DISPLAY" ;
}
if (!flag)
{
gotoxy(1,25) ;
cout <<"PRESS ANY KEY TO CONT..." ;
getche() ;
}
file.close () ;
}
//**********************************************************
// THIS FUNCTION GIVES DATA TO ADD RECORD IN THE CD FILE.
//**********************************************************
if (ch == 'Y')
{
if (found)
update_copies(tcode,tcopies,tavail) ;
else
add_new_cd(tcode,tname,tcopyright,tprice,tcopies,tavail) ;
}
do
{
gotoxy(30,17) ; clreol() ;
cout <<"ADD MORE CD'S ?(Y/N) : " ;
ch = getche() ;
ch = toupper(ch) ;
} while (ch != 'Y' && ch != 'N') ;
} while (ch == 'Y') ;
}
92
//**********************************************************
// THIS FUNCTION GIVES DATA TO ADD RECORD IN THE CUSTOMER FILE
//**********************************************************
93
cout <<" ENTER CUSTOMERS NAME (NO DIGITS
PLEASE!!)" ;
gotoxy(38,10) ; clreol() ;
gets(mname);
strupr(mname);
if(mname[0]=='0')
return;
int flag=0;
m1=strlen(mname);
for(i=0;i<m1;i++)
{
if(mname[i]<65||mname[i]>91)
{
if(mname[i]!=32)
flag=1;
}break;
}
if(flag)
{
valid=0;
gotoxy(5,25);
clreol();
cout<<"\7 ENTER CORRECTLY(RANGE 1...25)";
getch();
}//end of if
} while(! valid); //end of do while
do
{
valid = 1 ; int flag=0;
gotoxy(5,25) ; clreol() ;
cout <<"ENTER PHONE NO. OR <ENTER> FOR NONE
(ONLY DIGITS PLZ!)" ;
gotoxy(38,12) ; clreol() ;
gets(mphone) ;
if (mphone[0] == '0')
return ;
for(int i=0;i<strlen(mphone);i++)
{
if((mphone[i]>='A' && mphone[i]<='Z')||
(mphone[i]>='a' && mphone[i]<='z'))
{
valid=0;
gotoxy(35,23);
94
break;
}
}
add_mem(mcode,bcode,mname,maddress,mphone,d1,m1,y1) ;
mcode++ ;
}
do
{
gotoxy(25,25) ; clreol() ;
cout <<"ADD NEW CUSTOMER ?(Y/N) : " ;
ch = getche() ;
ch = toupper(ch) ;
if (ch == '0')
return ;
} while (ch != 'Y' && ch != 'N') ;
} while (ch == 'Y') ;
}
//**********************************************************
// THIS FUNCTION ISSUES THE CD
//**********************************************************
mcode = t2code ;
if (issued(mcode)!= 0)
{
valid = 0 ;
gotoxy(5,10) ;
cout <<"\7CUSTOMER IS ALREADY HAVING A CD" ;
gotoxy(5,11) ;
cout <<"PRESS <ESC> TO EXIT OR ANY OTHER KEY
TO CONT..." ;
ch = getch() ;
if (ch == 27)
return ;
}
if (mcode == 0)
98
{
valid = 0 ;
gotoxy(5,25) ;
cout <<"\7PLEASE ENTER CORRECTLY!!" ;
getch() ;
}
if (!member_found(mcode) && valid)
{
valid = 0 ;
gotoxy(5,13) ;
cout <<"\7NO SUCH RECORDS" ;
gotoxy(5,14) ;
cout <<"PRESS <ESC> TO EXIT OR ANY OTHER KEY
TO CONT..." ;
ch = getch() ;
if (ch == 27)
return ;
}
} while (!valid) ;
int tcopies, tavail ;
//**********************************************************
// THIS FUNCTION RETURNS THE CD FOR THE CUSTOMER
//**********************************************************
102
cout <<"PRESS <ESC> TO EXIT OR ANY OTHER KEY
TO CONT.." ;
ch = getch() ;
if (ch == 27)
return ;
}
} while (!valid) ;
if (tcode == 0)
tcode = cdcodeof(t1code) ;
clrscr() ;
gotoxy(72,1) ;
cout <<"EXIT (0)" ;
CD::display(tcode) ;
do
{
gotoxy(20,13) ; clreol() ;
cout <<"DO YOU WANT TO MODIFY THIS RECORD ?
(Y/N) : " ;
ch = getche() ;
ch = toupper(ch) ;
if (ch == '0')
return ;
} while (ch != 'Y' && ch != 'N') ;
if (ch == 'N')
return ;
gotoxy(5,16) ;
cout <<"CD NAME : " ;
gotoxy(5,17) ;
cout <<"COPYRIGHT : " ;
gotoxy(5,18) ;
cout <<"PRICE : Rs." ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"ENTER NEW NAME OF THE CD OR <ENTER>
FOR NO CHANGE" ;
gotoxy(19,16) ; clreol() ;
gets(tname) ;
strupr(tname) ;
if (tname[0] == '0')
return ;
if (strlen(tname) > 32)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
103
cout <<"\7PLEASE ENTER CORRECTLY :- 1..32)" ;
getch() ;
}
} while (!valid) ;
if (strlen(tname) == 0)
strcpy(tname,cdname(tcode)) ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"ENTER NEW COPYRIGHTERS NAME OR
<ENTER> FOR NO CHANGE" ;
gotoxy(19,17) ; clreol() ;
gets(tcopyright) ;
strupr(tcopyright) ;
if (tcopyright[0] == '0')
return ;
if (strlen(tcopyright) > 25)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7PLEASE ENTER CORRECTLY :-1..25)" ;
getch() ;
}
} while (!valid) ;
if (strlen(tcopyright) == 0)
strcpy(tcopyright,year(tcode)) ;
do
{
valid = 1 ;
gotoxy(5,25) ; clreol() ;
cout <<"ENTER NEW PRICE OR <ENTER> FOR NO
CHANGE" ;
gotoxy(22,18) ; clreol() ;
gets(t1) ;
t2 = atof(t1) ;
tprice = t2 ;
if (t1[0] == '0')
return ;
if (strlen(t1) == 0)
break ;
if (tprice < 1 || tprice > 9999)
{
valid = 0 ;
gotoxy(5,25) ; clreol() ;
cout <<"\7PLEASE ENTER CORRECTLY" ;
104
getch() ;
}
} while (!valid) ;
if (strlen(t1) == 0)
tprice = cdprice(tcode) ;
gotoxy(5,25) ; clreol() ;
do
{
gotoxy(30,20) ; clreol() ;
cout <<"SAVE THIS RECORD ? (Y/N) : " ;
ch = getche() ;
ch = toupper(ch) ;
if (ch == '0')
return ;
} while (ch != 'Y' && ch != 'N') ;
if (ch == 'N')
return ;
CD::modify(tcode,tname,tcopyright,tprice) ;
gotoxy(5,23) ;
cout <<"\7RECORD MODIFIED!!" ;
getch() ;
}
//**********************************************************
// THIS FUNCTION GIVES DATA TO MODIFY THE CUSTOMER RECORD
//**********************************************************
108
//**********************************************************
// THIS FUNCTION GIVES CD CODE TO DELETE THE CD RECORD
//**********************************************************
//**********************************************************
// THIS FUNCTION GIVES CUSTOMER CODE TO DELETE THE CUSTOMER
// RECORD
//**********************************************************
//**********************************************************
// MAIN FUNCTION CALLING INTRODUCTION AND MAIN MENU
//**********************************************************
void main(void)
{
MENU menu ;
menu.introduction() ;
menu.main_menu() ;
}
112
CHAPTER 8
RESULTS & CONCLUSION
d. The system will save the time in preparation of routine reports at each level of
computerization.
e. The system also helps in raising the technical standard of the staff in the domain
113
REFERENCES
114