Académique Documents
Professionnel Documents
Culture Documents
CURRICULUM
FOR THE YEAR 2010-11
CONTENTS
CERTIFICATE
ACKNOWLEDGEMENT
PROJECT PREAMBLE
PROJECT STUDY
ALGORITHM
SOURCE CODE
OUTPUT
CERTIFICATE
_______________,
includes validations.
PROJECT STUDY
CLASSES & FUNCTIONS USED IN THE PROJECT :
//**********************************************************
// THIS CLASS CONTROL ALL THE FUNCTIONS IN THE MENU
//**********************************************************
class MENU
{
public :
void main_menu(void) ;
private :
void edit_menu(void) ;
void edit_book(void) ;
void edit_member(void) ;
};
//**********************************************************
// THIS CLASS CONTAINS FUNCTIONS RELATED TO BOOKS
//**********************************************************
class BOOK
{
public :
void list(void) ;
char *bookname(int) ;
protected :
void add_new_book(int, char tname[33], char tauthor[26], float, int, int) ;
void update_copies(int, int, int) ;
void modify(int, char[], char[], float) ;
void deletion(void) ;
int book_found(int) ;
int bookname_found(char []) ;
int recordno(int) ;
int available(int) ;
char *authorname(int) ;
float bookprice(int) ;
int no_of_copies(int) ;
int bookcodeof(char[]) ;
void display(int) ;
int reccount(void) ;
void delete_rec(int) ;
private :
int bookcode, copies ;
char name[33], author[26] ;
float price ;
int avail ;
};
//**********************************************************
// THIS CLASS CONTAINS FUNCTIONS RELATED TO MEMBERS
//**********************************************************
class MEMBER
{
public :
void list(void) ;
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) ;
void update_book(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, bookcode ;
char name[26], phone[10], address[33] ;
int dd, mm, yy ; // DATE OF RETURNING THE BOOK //
};
//**********************************************************
// THIS IS DERIVED FROM CLASS BOOK & MEMBER 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 ;
};
ALGORITHM
FOR INSERTING A RECORD TO A FILE:
Open the file in append mode.
Input the information for the record from the user.
Using ‘write’ function available in file ‘fstream.h’ write the record on
the file.
Close the file.
*****************************************************************
********************************************************************/
// HEADER FILES
#include<dos.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<fstream.h>
/*******************************************************************
CLASS BILL
*******************************************************************/
class mobile
{
private :
char name[30];
char add[50];
long int acno,dd,mm,yy;
char telno[11];
int monthrental;
int usagecharges;
int servicetax;
int netamt;
public :
int last_code(void);
void getdata();
void display();
void calc();
void putrecord();
void disrecord();
void disonerecord();
void delrecord();
void modify();
void generate();
void re_getdata();
};
/*********************************************************************
*********************************************************************/
int mobile::last_code(void)
{
fstream file;
file.open(FNAME,ios::in | ios::binary);
file.seekg(0,ios::beg);
int count=0;
while (file.read((char*)this,sizeof(mobile)))
count=acno;
file.close();
return count;
}//end of function lastcode
/*********************************************************************
*********************************************************************/
do
{
valid=1;
gotoxy(5,9);
clreol();
cout<<"ENTER THE NAME:";
gotoxy(40,9);
clreol();
gets(name);
strupr(name);
if(strlen(name) < 1 || strlen(name) > 30)
{
valid=0;
gotoxy(5,25);
clreol();
cout<<"\7 ENTER CORRECTLY(RANGE 1...30)";
getch();
}//end of if
} while(! valid); //end of do while
do
{
valid=1;
gotoxy(5,11);
clreol();
cout<<"ENTER ADDRESS:";
gotoxy(40,11);
clreol();
gets(add);
if (strlen(add) < 1||strlen(add) > 30)
{
valid=0;
gotoxy(5,25);
clreol();
cout<<"ENTER CORECTLY(RANGE:1...30)";
getch();
}// end of if
} while(!valid); //end of do while
do
{
valid=1;
gotoxy(5,13);
clreol();
cout<<"ENTER PHONE NUMBER:";
gotoxy(40,13);
clreol();
gets(telno);
if((strlen(telno)<10 && strlen(telno)>0 || (strlen(telno)>10)))
{
valid=0;
gotoxy(5,25);
clreol();
cout<<"ENTER CORRECTLY";
getch();
}//end of if
} while(!valid); //end of do while
do
{
valid=1;
gotoxy(5,15);
clreol();
cout<<"ENTER MONTHLY RENTAL:";
gotoxy(40,15);
clreol();
cin>>monthrental;
if( monthrental<=0)
{
valid=0;
gotoxy(5,25);
clreol();
cout<<"ENTER CORRECTLY";
getch();
}//end of if
} while(!valid); //end of do while
usagecharges=0;
servicetax=0;
netamt=0;
dd=0,mm=0,yy=0;
gotoxy(30,40);
cout<<"Thank you"<<endl;
cout<<"press any key to continue...";
getch();
}
/******************************************************************
******************************************************************/
/******************************************************************
*******************************************************************/
/******************************************************************
*******************************************************************/
/******************************************************************
*******************************************************************/
/******************************************************************
*******************************************************************/
}
else
n.write((char*)this,sizeof(mobile));
f.read((char*)this,sizeof(mobile));
}
f.close();
n.close();
if (flag==1)
{ remove(FNAME);
rename("new.txt",FNAME);
}
else
cout<<"matching record not found\n";
gotoxy(27,19);
cout<<"Press any key to continue...";
getch();
}
/******************************************************************
******************************************************************/
fstream f;
flag=0;
f.open(FNAME,ios::in | ios::binary);
f.read((char*)this,sizeof(mobile));
while(f)
{
if(strcmp(telno,tno)==0)
{
clrscr();
flag=1;
display();
break;
}
f.read((char*)this,sizeof(mobile));
}
f.close();
if(flag==0)
{
gotoxy(32,16);
cout<<"Record not found";
}
gotoxy(20,18);
cout<<"Press any key to continue............";
getch();
}
/******************************************************************
********************************************************************/
/******************************************************************
******************************************************************/
/***************************************************************************
VOID MAIN
***************************************************************************/
void main()
{
clrscr();
mobile e;
int ch;
char ans;
long int pass;
while (1)
{
clrscr();
gotoxy(32,8);
cprintf(" MOBILE BILL ");
gotoxy(35,10);
cprintf(" OPTIONS ");
gotoxy(28,12);
cout <<"1: INSERT NEW USER";
gotoxy(28,14);
cout <<"2: DISPLAY RECORD OF A USER";
gotoxy(28,16);
cout <<"3: DISPLAY ALL RECORDS";
gotoxy(28,18);
cout <<"4: DELETE A RECORD";
gotoxy(28,20);
cout <<"5: MODIFY A RECORD";
gotoxy(28,22);
cout <<"6: GENERATE BILL";
gotoxy(28,26);
cout <<"0: QUIT";
gotoxy(28,28);
cout <<"ENTER YOUR CHOICE: ";
char ch=getche();
if (ch == 27)
break;
else
if (ch == '1')
{
clrscr();
e.putrecord();
}
else
if (ch == '2')
{
clrscr();
e.disonerecord();
}
else
if (ch == '3')
{
clrscr();
e.disrecord();
}
else
if(ch == '4')
{
clrscr();
e.delrecord();
}
else
if( ch == '5')
{
clrscr();
e.modify();
}
else
if( ch == '6')
{
clrscr();
e.generate();
}
if( ch == '0')
break;
}
}
MOBILE BILL MANAGEMENT SYSTEM
OPTIONS
4: DELETE A RECORD
5: MODIFY A RECORD
6: GENERATE BILL
0: QUIT
ENTER DATA
~~~~~~~~~~~~~~
ACCOUNT NO. IS : 1
ENTER THE NAME: NITIN
ENTER ADDRESS: WZ-38 ROHINI NEW DELHI
ENTER PHONE NUMBER: 9810023100
ENTER MONTHLY RENTAL: 250
Thank you
press any key to continue...
Name : NITIN
Address :WZ-38 ROHINI NEW DELHI
Mobile No. :9810023100
Acc.no :1
Monthly Rental :250
Usage Charges :0
Service Tax(12.36%) :0
Total Charges :Rs.0
Name : NITIN
Address :WZ-38 ROHINI NEW DELHI
Mobile No. :9810023100
Acc.no :1
Monthly Rental :250
Usage Charges :0
Service Tax(12.36%) :0
Total Charges :Rs.0
Record No:1
Name : NITIN
Address :WZ-38 ROHINI NEW DELHI
Mobile No. :9810023100
Acc.no :1
Monthly Rental :250
Usage Charges :0
Service Tax(12.36%) :0
Total Charges :Rs.0
DELETE A RECORD
RECORD TO MODIFY
Name : NITIN
Address :WZ-38 ROHINI NEW DELHI
Mobile No. :9810023100
Acc.no :1
Monthly Rental :250
Usage Charges :0
Service Tax(12.36%) :0
Total Charges :Rs.0
GENERATE BILL
BILL
BILL Date :29-10-2007
Name :NITIN
Address : RZ-90 ROHINI NEW DELHI
Mobile No. :9810023100
Acc.no :1
Monthly Rental :250
Usage Charges :250
Service Tax(12.36%) :61
Total Charges :Rs.561