Payroll Management System C++
Payroll Management System C++
Payroll Management System C++
INTRODUCTION
The aim of this TELEPHONE BILLING SYSTEM is to deliver a reliable system that will allow
the user to generate the bills of the services used by the consumer and also keep the record of the
payments based upon the OOPS
The TELEPHONE BILLING SYSTEM is an entirely unique project that deals with the services of the
communication providers to generate the proper bills and also store the user details as a database of
the consumers. The code has been designed in such a way that it ensures a user friendly interface .
The objective and scope of this project is to record the various details & activities of the consumer. It
simplifies the work and reduces the paper work. It allows the service providers to store the details of
the consumers and also display the debits and credits to be issued. It also allows the modification and
enquiry of the consumer details. It overcomes the procedural programming concept with the object
oriented programming concepts. The project is a good application of the data file handling concepts
using C++. The system ensures an error free and user friendly computing.
Page | 1
2.SYSTEM SPECIFICATION
2.1 Development environment
2.1.1 Hardware configuration
Processor
: Intel corei5
Ram
: 8GB
Graphics adaptor
Monitor
Keyboard
Mouse
: WINDOWS 10
Editor
: DOSBox
Programming language
: C++
OOP concepts
used
Features used
Database
: SQL
Page | 2
Objects
Classes
Inheritance
Data Encapsulation
Polymorphism
Reusability
Data Abstraction
In order to understand the basic concepts in C++, a programmer must have good
knowledge of the basis terminology in object oriented programming. Below is a
brief outline of the concepts of objects oriented programming languages.
OBJECTS :
Object is the basic unit of object oriented programming. Objects are identified
by its unique name. An object represents a particular instance of class and can
hold its own relevant data. An object is collection of data members and
associated member functions also known as methods
CLASSES :
Classes are the data types on which objects are created. Objects with similar
properties and methods are grouped together to form a class. Thus a class
represents a set of indivisual objects. Characteristics of an object are represented
in a class as properties. The actions that can be performed by objects become
functions of the class and are referred to as methods.
For example consider we have a class of cars under which sandro xiang, Alto
and wagoner represents individual objects. In the context each car object will
have its own models .year of Manufacture colour, Top Speed, Engine Power etc
which form properties of the car class and the associated actions i.e. object
functions like Start, Move and Stop from the methods of car class. No memory
is allocated when a class is created. Memory is allocated only when an object is
created i.e when an instance of classis created.
INHERITANCE :
Page | 3
Inheritance is the process of forming a new class from an existing class or basic
class. The base class is also known a parent class or super class. The new class
that is formed is called derived class. Derived class is also known as child class
or sub class . Inheritance helps in reducing the overall code size of the program,
which is an importance concept of object oriented programming.
DATA ENCAPSULATION :
Data encapsulation combines data and functions in to a single unit called class.
When using data encapsulation, data not accessed directed, it is only accessible
through the function present inside the class. Data encapsulation enables the
important concept of data hiding possible.
DATA ABSTRACTION :
Data abstraction increases the power of programming language by creating user
defined data types. Data abstraction also represents the needed information in
the program without presenting the back ground details.
POLYMORPHISM :
Polymorphism allows routines to use variable of different types at different
times. An operator or function can be given different meanings or functions.
Polymorphism refers to a single function or multi- functioning operator
performing in different ways
OVERLOADING :
Overloading is one type of polymorphism. It allows an object to have different
meanings, depending on its context. When an existing operator or function
beings to operate on new data type or class, it is understood to be overloaded.
REUSABILITY :
This is a time saving devices and adds code efficiency to the language.
Additionally, the programmer can incorporate new features to the existing class,
further developing the application and allowing users to achieve increased
peformance. This time saving features optimizes coding and helps in gaining
secured application and facilitates easier maintenance on the application
Page | 4
3.SYSTEM DESIGN
3.1Functional design
In many programming languages, the main function is where a function starts
execution. It is responsible for the high level organization of the programs
functionality , and typically had access to the command arguments given to the
program when it was executed. Thus main; is very important to run your code.
The main function is generally the first programmer written function run when a
program starts, it is invoked directly from the system specific initialization
contained in crt0 or equivalent. However, some languages can run user written
functions before main runs, such as the constructor of C++ global objects.
In this project, the main function is compiled first.
SL.N
O
1.
2.
3.
Classe sused
Function
Description
Consumer
Consumer
Consumer
4.
Consumer
get_data()
Function to enter details
show_data() Function to display details
Created()
To display the welcome
screen
Proj_name( To display the name of
)
project
Files
m.dat
m.dat
m.dat
m.dat
get-data: It is a member function used to enter all the consumer details and
generate the necessary bills.
show_data: It is a member function used to display all the outputs associated
with this project.
Page | 5
START
ENTER YOUR
CONDITION
ENTE
DISPL
GETDATA
ENQUI
RE
MODI
CONDITION
STOP
EXIT
DISPL
Page | 6
4. SYSTEM TESTING
&MAINTENANCE
For correctness
For implementation
For computational complexity
While testing whenever an error occurs, it was corrected then and there.
Unit testing
Integration
Validation testing
Output testing
Black box testing
White box testing
Page | 7
Page | 8
5.CONCLUSION
Page | 9
6. BIBLIOGARPHY
TEXTBOOKS:
1. Computer Science with C++ - A textbook for class XII By Sumita
Arora.
2. Computer Science with C++ - A textbook for class XI By Sumita
Arora.
WEBSITES:
1. http:// www.cplusplusforum.com
2. http//: www.w3schools.com
Page | 10
7. APPENDIX
7.1 SOURCE CODE
//PROJECT- TELEPHONE BILLING SYSTEM
//BY : ROHAN SHARMA SITOULA
//
INCLUDED HEADERFILES
#include<graphics.h>
#include<fstream.h>
#include<iomanip.h>
#include<string.h>
#include<process.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<dos.h>
void proj_name(void);
Page | 11
void created(void);
class consumer
{
public:
long unsigned int tel_no;
long unsigned int con_no;
char name[60];
char add[300];
char city[40];
long unsigned int op_rdg;
long unsigned int cl_rdg;
long unsigned int met_calls;
long unsigned int free_calls;
long unsigned int charge_calls;
float met_charge;
float rent;
float debits;
float tax;
float credits;
float gross_amt;
float surcharge;
long unsigned int net_amt_bef;
long unsigned int net_amt_aft;
public:
void get_data();
void show_data();
};
// FUNCTION TO RECIEVE DATA
Page | 12
void consumer::get_data()
{
setfillstyle(1,BLACK);
bar(0,0,680,480);
consumer g1; int a; char ch;
setlinestyle(0,0,3);
setcolor(BROWN);
settextstyle(1,0,5);
outtextxy(90,20,"ENTER THE RECORD:-");
setfillstyle(1,BLACK);
bar(50,100,550,400);
rectangle(50,100,550,400);
gotoxy(10,10);
cout<<"TELEPHONE NO.
:";
cout<<tel_no;
cin.get(ch);
gotoxy(10,12);
cout<<"NAME
:";
cin.getline(name,60);
gotoxy(10,14);
cout<<"ADDRESS
:";
cin.getline(add,300);
gotoxy(10,16);
cout<<"CITY
:";
cin.getline(city,40);
gotoxy(10,18);
cout<<"OPENING READING :";
cin>>op_rdg;
Page | 13
gotoxy(10,20);
cout<<"CLOSING READING :";
cin>>cl_rdg;
met_calls=cl_rdg-op_rdg;
free_calls=150;
rent=360;
if(met_calls<free_calls)
{
charge_calls=0;
met_charge=0;
}
else
{
charge_calls=met_calls-free_calls;
met_charge=charge_calls*(.80);
}
gotoxy(10,22);
cout<<"DEBITS
:";
cin>>debits;
tax=(rent+met_charge+debits)/20;
gross_amt=(met_charge+rent+tax+debits);
gotoxy(10,24);
cout<<"CREDITS
:";
cin>>credits;
if(credits>gross_amt)
net_amt_bef=0;
else
net_amt_bef=gross_amt-credits;
Page | 14
if(credits>=gross_amt)
surcharge=0;
else
surcharge=20;
net_amt_aft=net_amt_bef+surcharge;
}
// FUNCTION TO DISPLAY DATA
void consumer::show_data()
{
bar(0,0,660,480);
setcolor(BLUE);
settextstyle(8,0,3);
outtextxy(55,10,"KHAN COMMUNICATIONS PVT LIMITED");
setlinestyle(1,0,3);
line(51,40,486,40);
gotoxy(10,5);
settextstyle(3,0,1);
setcolor(BROWN);
outtextxy(15,55,"TELEPHONE NO.");
outtextxy(330,55,"CONSUMER NO.");
outtextxy(15,170,"OPENING READING ");
outtextxy(15,205,"CLOSING READING ");
outtextxy(15,235,"METERED CALLS
outtextxy(15,268,"FREE CALLS
");
");
");
Page | 15
outtextxy(330,235,"TAXES
");
outtextxy(330,268,"GROSS AMOUNT
outtextxy(330,300,"CREDITS
outtextxy(330,140,"RENTAL
");
");
");
setcolor(MAGENTA);
outtextxy(15,327,"AMOUNT PAYABLE IF PAID ON OR BEFORE ");
setcolor(BROWN);
outtextxy(15,350,"SURCHARGE
");
setcolor(MAGENTA);
outtextxy(15,377,"AMOUNT PAYABLE IF PAID ON OR AFTER ");
setcolor(RED);
setlinestyle(0,0,3);
bar(70,90,320,160);
rectangle(70,90,320,160);
gotoxy(20,5);
cout<<tel_no;
gotoxy(60,5);
cout<<con_no;
gotoxy(12,7);
cout<<name<<"\n";
gotoxy(12,8);
cout<<add<<"\n";
gotoxy(12,9);
cout<<city;
gotoxy(54,10);
cout<<setw(20)<<rent;
gotoxy(25,12);
cout<<setw(15);
Page | 16
cout<<op_rdg;
gotoxy(25,14);
cout<<setw(15)<<cl_rdg;
gotoxy(25,16);
cout<<setw(15)<<met_calls;
gotoxy(25,18);
cout<<setw(15)<<free_calls;
gotoxy(25,20);
cout<<setw(15)<<charge_calls;
gotoxy(59,12);
cout<<setw(15)<<met_charge;
gotoxy(59,14);
cout<<setw(15)<<debits;
gotoxy(59,16);
cout<<setw(15)<<tax;
gotoxy(59,18);
cout<<setw(15)<<gross_amt;
gotoxy(59,20);
cout<<setw(15)<<credits;
gotoxy(50,22);
cout<<setw(5)<<net_amt_bef;
gotoxy(25,23);
cout<<setw(15)<<surcharge;
gotoxy(50,25);
cout<<setw(5)<<net_amt_aft;
}
void main()
Page | 17
{
char ans; int con_no;
int gd=DETECT,gm; int i,j;
int midx,midy;
initgraph(&gd,&gm,"c:\\tc\\bgi");
midx=getmaxx()/2; midy=getmaxy()/2;
/*char*pass="HELLO";
char*ppass;
gotoxy(25,8);
ppass=getpass("ENTER THE PASSWORD::");
if(strcmpi(pass,ppass)!=0)
{
setcolor(GREEN);
settextstyle(1,0,4);
outtextxy(140,220,"INVALID PASSWORD");
sleep(3);
exit(1);
}*/
setlinestyle(1,0,2);
setfillstyle(1,GREEN);
rectangle(2,1,660,660);
bar(2,1,660,660);
setcolor(RED);
for(i=90;i<=385;i+=17)
{
outtextxy(50,i,"^");
outtextxy(560,i,"^");
}
Page | 18
for(j=50;j<=560;j+=17)
{
outtextxy(j,90,"^");
outtextxy(j,385,"^");
}
setfillstyle(1,RED);
ellipse(310,240,0,360,240,120);
fillellipse(310,240,240,120);
setfillstyle(1,BLACK);
ellipse(312,241,0,360,200,100);
fillellipse(312,241,200,100);
setfillstyle(1,RED);
ellipse(314,242,0,360,160,80);
fillellipse(314,242,160,80);
settextstyle(0,0,3);
settextstyle(0,HORIZ_DIR,4);
setcolor(BLUE);
outtextxy(200,190,"WELCOME");
settextstyle(1,0,4);
for(i=220;i<221;i++)
{
outtextxy(280,i,"TO");
}
settextstyle(0,0,3);
for(i=270;i<271;i++)
{
outtextxy(190,270,"OUR PROJECT");
}
Page | 19
sleep(1);
sleep(1);
proj_name();
sleep(1);
created();
fstream fin; consumer g1;
i:
fin.open("m.dat",ios::in|ios::out|ios::app|ios::ate|ios::binary);
fin.seekg(0,ios::end);
int a; char answer;
setfillstyle(1,GREEN);
rectangle(0,0,600,480);
bar(0,0,700,480);
setcolor(BLACK);
settextstyle(1,0,5);
setlinestyle(1,0,3);
outtextxy(10,20,"ENTER YOUR CHOICE:-");
settextstyle(1,0,3);
outtextxy(100,120,"PRESS 1:TO ADD NEW RECORD");
outtextxy(100,150,"PRESS 2:TO SEE THE RECORDS");
outtextxy(100,180,"PRESS 3:FOR ENQUIRY");
outtextxy(100,210,"PRESS 4:FOR MODIFICATION");
outtextxy(100,240,"PRESS 5:FOR EXIT");
setfillstyle(1,RED);
bar(580,370,640,420);
gotoxy(77,25);
cin>>a;
setfillstyle(1,0);
Page | 20
if(g1.tel_no==tel_no)
{
bar(0,0,679,679);
settextstyle(1,0,3);
setfillstyle(1,WHITE);
Page | 21
bar(20,200,610,250);
outtextxy(20,220,"PERSON WITH THIS TELEPHONE_NO ALREADY
EXISTS");
delay(2000);
goto u;
}
}while(!fin.eof());
fin.close();
fin.open("m.dat",ios::app|ios::out|ios::in|ios::ate|ios::binary);
fin.seekg(0,ios::end) ;
long unsigned int r=fin.tellg();
long unsigned int t=(r/sizeof(g1))+1;
con_no=t;
g1.tel_no=tel_no;
g1.con_no=con_no;
g1.get_data();
fin.write((char*)&g1,sizeof(g1));
setcolor(RED);
settextstyle(8,0,4);
outtextxy(12,420,"ENTER ANY OTHER RECORD(Y/N)");
setfillstyle(1,4);
bar(250,450,270,470);
gotoxy(37,35);
answer=getche();
}
while ((answer=='Y')||(answer=='y'));
goto u;
}
Page | 22
//FOR ENQUIRY
else if (a==3)
{
long unsigned int tel_no1;
bar(0,0,679,679);
setcolor(RED);
outtextxy(70,150,"ENTER THE TELEPHONE_NO OF PERSON :");
gotoxy(35,15);
cin>>tel_no1;
bar(0,0,679,679);
fin.seekg(0);
Page | 23
do
{
fin.read((char*)&g1,sizeof(g1));
if(fin.eof())
goto y;
else if(g1.tel_no==tel_no1)
break;
}
while(fin);
g1.show_data();
getch();
goto u;
}
//FOR MODIFICATION
else if(a==4)
{
long unsigned int tel_no2;
long unsigned int con_no;
char name[60];
char add[300];
char city[40];
long unsigned int op_rdg;
long unsigned int cl_rdg;
long unsigned int met_calls;
long unsigned int free_calls;
long unsigned int charge_calls;
float met_charge;
Page | 24
float rent;
float debits;
float tax;
float credits;
float gross_amt;
float surcharge;
long unsigned int net_amt_bef;
long unsigned int net_amt_aft;
bar(0,0,679,679);
setcolor(BLUE);
outtextxy(100,150,"ENTER THE TELEPHONE_NO OF PERSON ");
outtextxy(100,180,"
TO BE MODIFIED
");
gotoxy(35,17);
cin>>tel_no2;
setfillstyle(1,0);
fin.seekg(0);
do
{
fin.read((char*)&g1,sizeof(g1));
if(fin.eof())
{
setfillstyle(1,LIGHTMAGENTA);
bar(0,0,679,679);
setfillstyle(1,WHITE);
bar(40,200,565,250);
setcolor(BLUE);
settextstyle(1,0,3);
outtextxy(70,220,"DESIRED TELEPHONE_NO DOES NOT EXISTS");
Page | 25
delay(2000);
setfillstyle(1,0);
goto u;
}
if(g1.tel_no==tel_no2)
{
char ch;
long unsigned int b=fin.tellg();
long unsigned int s=sizeof(g1);
fin.close();
fin.open("m.dat",ios::out|ios::ate|ios::binary);
fin.seekp(b-s);
setfillstyle(1,BLACK);
bar(0,0,680,480);
setlinestyle(0,0,3);
setcolor(WHITE);
settextstyle(1,0,5);
outtextxy(90,20,"ENTER THE RECORD:-");
setfillstyle(1,GREEN);
bar(50,100,550,400);
rectangle(50,100,550,400);
gotoxy(10,10);
cout<<"TELEPHONE NO.
:";
cout<<g1.tel_no;
cin.get(ch);
gotoxy(10,12);
cout<<"NAME
:";
cin.getline(name,60);
Page | 26
gotoxy(10,14);
cout<<"ADDRESS
:";
cin.getline(add,300);
gotoxy(10,16);
cout<<"CITY
:";
cin.getline(city,20);
gotoxy(10,18);
cout<<"OPENING READING :";
cin>>op_rdg;
gotoxy(10,20);
cout<<"CLOSING READING :";
cin>>cl_rdg;
met_calls=cl_rdg-op_rdg;
free_calls=150;
rent=360;
if(met_calls<free_calls)
{
charge_calls=0;
met_charge=0;
}
else
{
charge_calls=met_calls-free_calls;
met_charge=charge_calls*(.80);
}
gotoxy(10,22);
cout<<"DEBITS
:";
cin>>debits;
Page | 27
tax=(rent+met_charge+debits)/20;
gross_amt=(met_charge+rent+tax+debits);
gotoxy(10,24);
cout<<"CREDITS
:";
cin>>credits;
if(credits>gross_amt)
net_amt_bef=0;
else
net_amt_bef=gross_amt-credits;
if(credits>=gross_amt)
surcharge=0;
else
surcharge=20;
net_amt_aft=net_amt_bef+surcharge;
g1.con_no=g1.con_no;
strcpy(g1.name,name);
strcpy(g1.add,add);
strcpy(g1.city,city);
g1.op_rdg=op_rdg;
g1.cl_rdg=cl_rdg;
g1.met_calls=met_calls;
g1.free_calls=free_calls;
g1.charge_calls=charge_calls;
g1.met_charge=met_charge;
g1.rent=rent;
g1.debits=debits;
g1.tax=tax;
g1.credits=credits;
Page | 28
g1.gross_amt=gross_amt;
g1.surcharge=surcharge;
g1.net_amt_bef=net_amt_bef;
g1.net_amt_aft=net_amt_aft;
fin.write((char*)&g1,sizeof(g1));
goto kk;
}
}while(fin);
kk:setfillstyle(1,LIGHTMAGENTA);
bar(0,0,679,679);
setfillstyle(1,WHITE);
bar(35,200,550,250);
setcolor(BLUE);
settextstyle(1,0,3);
outtextxy(80,220,"RECORD OF THIS PERSON IS MODIFIED");
delay(4000);
setfillstyle(1,0);
goto u;
}
//FOR EXIT
else
{
exit(0);
}
u:fin.close();
Page | 29
bar(0,0,680,480);
goto i;
y:setfillstyle(1,LIGHTMAGENTA);
bar(0,0,679,679);
settextstyle(TRIPLEX_FONT,0,3);
setfillstyle(1,WHITE);
bar(150,200,490,245);
setcolor(BLUE);
outtextxy(210,220,"RECORD NOT FOUND");
setfillstyle(1,0);
fin.close();
delay(2000);
goto u;
}
void proj_name(void)
{
fflush(stdin);
int midx,midy;
midx=getmaxx()/2;
midy=getmaxy()/2;
int i,j;
setcolor(BROWN);
setlinestyle(1,0,3);
setfillstyle(1,GREEN);
bar(2,1,660,660);
rectangle(2,1,660,660);
Page | 30
setcolor(RED);
setfillstyle(1,BROWN);
bar(25,75,575,425);
rectangle(25,75,575,425);
setfillstyle(1,GREEN);
bar(50,100,550,400);
rectangle(50,100,550,400);
setcolor(RED);
setfillstyle(1,BROWN);
bar(75,125,525,375);
rectangle(75,125,525,375);
setcolor(RED);
setfillstyle(1,GREEN);
bar(100,150,500,350);
rectangle(100,150,500,350);
setcolor(BLUE);
settextstyle(0,0,1);
settextstyle(1,0,6);
settextjustify(CENTER_TEXT,CENTER_TEXT);
for(i=170;i<=172;i++)
{
sleep(1);
outtextxy(291,i,
"TELEPHONE");
Page | 31
void created(void)
{
fflush(stdin);
setfillstyle(1,GREEN);
rectangle(2,1,660,660);
bar(2,1,660,660);
setcolor(WHITE);
setlinestyle(1,0,3);
settextstyle(1,0,8);
settextjustify(LEFT_TEXT,TOP_TEXT);
line(10,110,380,110);
outtextxy(10,20,"C");
settextstyle(4,0,8);
outtextxy(47,20,"reated By:-");
settextstyle(1,0,6);
settextjustify(LEFT_TEXT,CENTER_TEXT);
outtextxy(275,250,"ROHAN");
sleep(1);
sleep(1);
clrscr();
}
Page | 32
Page | 33
Page | 34
Page | 35
Page | 36
Page | 37
Page | 38