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

Employee Payroll Management System Guide

This document describes a proposed Employee Payroll Management System created by students at National University to fulfill course requirements. The system aims to automate payroll processes for companies by electronically tracking employee timecards and automatically generating paychecks based on hours worked and commissions earned, while properly accounting for salary deductions. Key features of the system include secure payroll computation, reduced paperwork, tracking of employee details, commission calculation, access controls, and report generation. The document outlines the system's objectives, limitations, interface, and programming description.

Uploaded by

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

Employee Payroll Management System Guide

This document describes a proposed Employee Payroll Management System created by students at National University to fulfill course requirements. The system aims to automate payroll processes for companies by electronically tracking employee timecards and automatically generating paychecks based on hours worked and commissions earned, while properly accounting for salary deductions. Key features of the system include secure payroll computation, reduced paperwork, tracking of employee details, commission calculation, access controls, and report generation. The document outlines the system's objectives, limitations, interface, and programming description.

Uploaded by

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

National University

551 M.F. Jhocson St, Sampaloc, Manila, 1008 Metro Manila

“Employee Payroll Management System”


_____________________________________________________
In Partial Fulfillment:
Of the Requirements for the Course
Fundamentals of Programming and Database Theory & Application (CFPDTAP)
______________________________________________________________________

Submitted by:
“ACCELERATORS”
Garcia, Kyle Nicole A.
Lanuza, Lienes T.
Mutuc, Christian Dave R.
Ordillas Hazel Jhosie B.

ACT151

Submitted to:
Mr. Rey Caranguian
Professor
National University

STATEMENT OF THE PROBLEM

Companies need a new system to allow employees to monitor time card information
electronically and automatically produce paychecks based in the actual number of hours worked and
total amount of commission which includes salary deductions such as SSS, Pag-IBIG and PhilHealth
and its taxes. The system ensures an error free and user friendly computing. It is essential for a
company especially those who have wide scale of employees to provide such system.

They need an accurate, clear, timely, fair and compliant salary record generation. Such systems
record crucial information and when there are discrepancies, it takes much time to figure it out and fix
it up. Salary computation includes such deductions and a there is a need to prove that it has presented
proper deductions in compliance with the laws. There are also countless things to do in a business and
it is more important to focus more in its growth and profitability. This kind of system is strongly
needed because sometimes, this takes too much of the management’s time to provide payroll details.
If such problem does arise, the proposed systematic record-keeping allows it to be resolved quickly
without using much resources.

OBJECTIVES

The objective and scope of this project is to record and generate the various details and
activities of the employees particularly its salary paychecks. This system displays a list of employee’s
information and their corresponding employer payroll system. A payroll system should not be above
complex and burdensome and that it should be constructed enough to be understood by many. We
believe that this project is a good application of the concepts using C++. Here are the objectives:

 To provide a secured and well-processed system for payroll computation.


 To process payroll information in an online environment that can be performed in less than the
hours it take manually.
 To reduce the paper work and simplifies the computation and preparation time.
 To help to track the details of the employee in a convenient way.
 To provide an instant procedure in calculation of commission amounts.
 To create a system with varied level access control.
 To calculate its gross pay for hourly employees based on the hours worked, including overtime.
 To calculate all payroll related taxes which the company paid and those withheld from the
employee’s pay.
 To create and file all required forms on a timely basis.
 To offer a consistent and verifiable details to the employees.
 To provide an easy report generation system.

1
National University

 To provide a cost-effective system that perform calculations efficiently and do not take more
resources.
 To keep all financial and HR documents in a methodical manner.

Rather than checking time cards manually and calculating its corresponding wages based on the
actual hours worked, it is more convenient and helpful computerizing this task which saves business
owners their time, effort and money. This will reduce incorrect and late receiving of checks. Having a
well-designed payroll system is one of the interesting factor for the employees, business owners and
human resources staff.

EMPLOYEE PAYROLL MANAGEMENT SYSTEM

One of the integral part of all organization is to compute the payroll of the employees. Small
businesses usually run their payroll systems similar to larger organizations. Payroll systems outline
when the company will pay employees (weekly, biweekly, monthly).

There are existing software packages that were used by small and large business for operations.
Payroll management software can ease the human workload by computing variables and it will be
hassle for a personnel to compute manually for bulk works in terms of calculating. The more variables
it can deal with, the fewer details will be necessary for payroll workers to concern themselves with.
Where payroll workers used to have to run over columns of figures with a calculator or adding
machine, the computer can now, metaphorically at least, do that for them.

Our group created a simple program called Employee Payroll Management System that is
designed for payroll computation and management. The structure of the program is simple in order for
the business owners to easily understand the payroll system. It is used particularly in computing the
net pay of a certain employee. The program is created to know the net pay of the employee after all
the deductions by just entering the name of the person and the hours he actually worked. Aside from
that, the user can see the breakdown of the payroll and can immediately print that out. The program
that we have created is not complicated. But there are other software that are used by business
providing outsourcing services for payroll computation.

The program was created through C++ language and used different statements such as loops,
arrays, switch case, if-else and any other. Source code of the program is provided in the latter part of
this paper.

2
National University

LIMITATIONS OF THE PROGRAM

 The program allows only a fixed amount of deduction (except for SSS)
The program does not follow the tables provided on computing a particular payroll
deduction. This program assumes that the employee is receiving the maximum
allowed compensation and deduct the possible maximum deduction.

 The program can’t occupy employees with the same name


As what have mentioned on the previous statements, name of the employee was used
as unique identifier in order to search the payroll information of the employees, so if
ever there were employees with same name, the program can’t occupy those two
names.

 The program is not usable by companies providing fixed salary to their


employees
The program is requiring the number of hours worked by a particular employee as a
basic of computing the gross pay, so if ever the company is providing fixed salary
(e.g. 20,000/ month) they can’t use this program.

 The datum stored in the program will lose if the user close the program
So there is no permanent storage of data using this program because as the user close
the program it’ll automatically remove all the stored data in the program.

DEFINITION OF TERMS:

Deductions - are amounts withheld from an employee's payroll check, and these amounts are
withheld by their employer (SSS, PhilHealth, Insurance, Pag-IBIG etc.).

Gross pay - is the amount of money your employees receive before any taxes and deductions are taken
out.

Net pay - is the amount of money your employees take home after all deductions have been taken out.

Payroll - a list of a company's employees and the amount of money they are to be paid.

Payroll management system – is a computerized system of managing and computing payroll of a


particular employee.

3
National University

PROGRAM INTERFACE AND DESCRIPTION

Figure 1: Main Menu of the Program

This figure shows what will appear when the user first open the program, the header indicates
the name of the company, address and the name of the system (the name and address on the above
figure is just an example to present the figure properly). The company who will use this can easily
change the header through changing it on the source code. The figure also shows the main menu of
the program which includes different options that will guide the user in using the program. It has
indicated a particular menu code for each menu in order for the user to access particular command.
The user will just encode the specific menu code of the command they want to access and the program
will immediately process it. The program includes five (5) options including [1] Add Employee
Option, [2] Sort Employee Entries Option, [3] Employee Search Option, [4] Print Records Option,
and [5] Quit Option which will discuss further on the next figures.

4
National University

Figure 2: Add Employee Option

The figure above shows what will appear if the user choose the Add Employee Option or
encode the menu code #1 on the program. When the user chooses this option the program will
immediately allow the user to input the name of the employee and the number of hours worked by that
particular employee. The data entered by the user will serve as the basis on computing the gross pay,
deductions, and net pay of the employees. The entered data will be stored in the program and user can
access it through declaring other options in the program. The true essence of the Add Employee Option
is really just to add employee data that will be used for the payroll system. There is no limit on the
number of employee data that will be add on the program as long as the program is open it can recall
those data stored on it.

5
National University

Figure 3: Employee Search Option

As what have mentioned on the description on the figure 2, as long as the program stayed open
the program can recall the information stored on it. So, in order for the user to recall or search the
payroll of a particular employee, the user should use the Employee Search Option of this program or
enter the menu code #3. This option allows the user to search the particular payroll of a particular
employee. It will display the gross payment of the employee which is based on the inputted number
of hours worked, different deductions on the gross payment which comprises of SSS, Pag-IBIG,
PhilHealth and Insurance (the user can add or remove some deductions based on the company’s policy
by editing it on the source code), and the net pay that a particular employee will received. When the
user choose this option, the program will immediately demand the name of the employee which will
serve as a unique identifier to search payroll information of that particular employee.

6
National University

Figure 4: Quit Option

The Quit Option will just allow the user to exit from the program. If the user entered the
menu code #5 the program will end and the message “Thank you for using this Program! Have a
nice day!” will appear. If the user closed the program, the data stored on it will automatically be
removed and the user need to add again new data when he/she wants to use the program again.

7
National University

Figure 5: Print Records Option

The figure above will show what will happened if the user selected the print records option.
The print records option will simply shows all the employee records as well as their payroll records
stored in the program using the Add Employee Option. So, this option will allow the user to have an
overview or to print all of the records of the employees using this program. The records that are stored
in this program are just those added while the program remains running. The presentation of the
records in this option is supposed to be in the table but because of some coding problems the
programmers wasn’t able to present it in that way. Despite of that, all of the necessary information are
still present when the user select this option.

8
National University

Figure 6: Sort Employee Entries Option

This Sort Employee Entries Option of the program just simple alphabetize all the entries stored
in the program. Notice that the name of the employees on Figure 5 above is not alphabetize because
sort employee entries is not yet applied but looking at this illustration when the user select the option
and wishes to select print all records option once again, the name of the employees are already
presented in an alphabetical way. This option really aims to organize the data stored in the program
especially if the user already inputted several number of data. It will help the user to easily find the
name of the employee because it is already arranged alphabetically.

9
National University

Figure 7: Invalid Menu Code

The figure illustrates the possibility if the user failed to enter a valid menu code. As the
illustration shows, it will display the message: “Error: Please Enter a Valid Menu Choice!!!” If the
user enters code that is not within the scope of the menu code that message will automatically
appear. This part of the programs avoids user from entering different code.

10
National University

INTERNAL COMPONENT OF THE PROGRAM (SOURCE CODE)

Figure 7: Switch Case Statement


For the main menu of the program, the program uses switch case statement. This statement
was the most appropriate statement for this kind of menu. The code comprises of five cases equivalent
to the five main menus provided on the program.
The SOURCE CODE of the program is presented below:
SOURCE CODE (PAYROLL MANAGEMENT SYSTEM)
#include <iostream>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <vector>
using namespace std;

class tax
{
public:

tax();
tax( string newLabel, string newShortLabel, double newRate, int
newType );
tax( string newLabel, string newShortLabel, double newRate, int
newType, int newCondition, string newConditionLabel, double newBound,
string newPrompt );

11
National University

tax( string newLabel, string newShortLabel, double newRate, int


newType, int newCondition, string newConditionLabel, double
newLowerBound, double newUpperBound, string newPrompt );

string getLabel();
string getShortLabel();
double getRate();
int getType();
int getCondition();
string getConditionLabel();
double getTestValue();
double getLowerBound();
double getUpperBound();
string getPrompt();

private:

string taxLabel;
string shortLabel;
string conditionLabel;
string taxPrompt;
double taxRate;
int taxType;

int conditionType;

double bound1;
double bound2;

};

class payscale
{
public:

payscale();
payscale(double newRate);
payscale(double newRate, double newHours);

double getMinHours();
double getRate();

private:
double minHours;
double payRate;
};

class employee
{

12
National University

public:

employee();

void get_input( vector<tax> taxes );


void compute_gross_pay( vector<payscale> payscales );
void compute_withholding( vector<tax> taxes );
void compute_net_pay();
void display( int displayMode, vector<tax> taxes );
bool is_matched( string queryName );

string getLabel();

private:

string label;
double hoursWorked;
double grossPay;
double netPay;
vector<double> taxInputs;
vector<double> deductions;

};

class database
{
public:

database();

void addEmployee( vector<tax> taxes, vector<payscale> payscales );


void sort( int sortType );
void print( int indexNumber, vector<tax> taxes );
void print( string queryName, vector<tax> taxes );
void printAll( vector<tax> taxes );

int getNumEmployees();
string getLabel();

private:

void swap( employee& x1, employee& x2 );

string dbLabel;
vector<employee> employees;

};

void printMenu( int menuNumber );

13
National University

void getMenuChoice( int& menuOption );


void doOperation( database& currentDB, int& menuNumber, int menuOption,
vector<tax> taxes, vector<payscale> payscales );

int main()
{

vector<tax> taxes;

taxes.push_back( tax("SSS Contribution", "S.S.S.", .0363, 2)


);

taxes.push_back( tax("Pag-IBIG Contribution", "Pag-IBIG",


100.00, 1) );

taxes.push_back( tax("Philhealth Contribution", "Philhealth",


250.00, 1) );

taxes.push_back( tax("Insurance Payments", "Insurance",


180.00, 1) );

vector<payscale> payscales;

payscales.push_back( payscale( 264.11 , 0.0 ) );

payscales.push_back( payscale( 264.11 , 40.0 ) );

payscales.push_back( payscale( 264.11 , 50.0 ) );

payscales.push_back( payscale( 264.11 , 60.0 ) );

cout <<
"\t\t=====================================================\n";
cout << "\t\tACCELERATOR - (Mutuc, Ordillas, Garcia, Lanuza &
Co.)\n";
cout << "\t\tUniversal LMS Building, Legaspi Village, Makati
City\n";
cout << "\t\t\tEMPLOYEE PAYROLL MANAGEMENT SYSTEM\n";
cout <<
"\t\t=====================================================\n";

database currentDB = database();

int menuOption = 0;

int menuNumber = 0;

while(true)
{

14
National University

printMenu( menuNumber );
getMenuChoice( menuOption );
doOperation( currentDB, menuNumber, menuOption, taxes,
payscales );
}
return 0;
}

void printMenu( int menuNumber )

{
switch(menuNumber)
{
case 0:
cout << endl << endl;
cout << "MAIN MENU -------------------" << endl;
cout << "[1] Add Employee" << endl;
cout << "[2] Sort Employee Entries" << endl;
cout << "[3] Employee Search/Display" << endl;
cout << "[4] Print All Records" << endl;
cout << "[5] Quit" << endl;
cout << "-----------------------------" << endl;
cout << "Menu Selection: ";

break;

default:
cout << "[Error: Please Enter a Valid Menu Choice!!!]" <<
endl;
exit(1);
break;
}
}

void getMenuChoice( int& menuOption )

{
string temp;
getline( cin, temp );

const int arraylen = ( temp.length() + 1 );


char input[arraylen];

for(int i=0; i < temp.length(); i++)


{
if( isdigit( temp[i] ))
input[i] = temp[i];
else

15
National University

{
menuOption = 0;
return;
}
}

input[arraylen - 1] = '\0';

menuOption = atoi(input);

void doOperation( database& currentDB, int& menuNumber, int menuOption,


vector<tax> taxes, vector<payscale> payscales )

{
if(menuOption == 0)
{
cout << "Error: Please Enter a Valid Menu Choice!!!" << endl;
return;
}

switch( menuNumber )
{
case 0:
{
switch( menuOption )
{
case 1:
currentDB.addEmployee( taxes, payscales );
break;

case 2:
currentDB.sort(1);
break;

case 3:
{
string queryName;
cout << endl << endl;
cout << "Please enter the NAME of the
Employee (Last, First): ";
getline( cin, queryName );
cout << endl;
currentDB.print( queryName, taxes );
}
break;

case 4:

16
National University

currentDB.printAll( taxes );
break;

case 5:
cout << endl << endl << endl;
cout << "Thank You for using this Program!
Have a nice day! :)" << endl;
exit(0);
break;

default:
cout << "Error: Please Enter a Valid Menu
Choice!!!" << endl;
}
break;
}

default:
cout << "[ Error: Please Enter a Valid Menu Choice!!!]"
<< endl;
exit(1);
}

tax::tax()
{}

tax::tax( string newLabel, string newShortLabel, double newRate, int


newType )
: taxLabel(newLabel) , shortLabel(newShortLabel) ,
taxRate(newRate) , taxType(newType)
{}

tax::tax( string newLabel, string newShortLabel, double newRate, int


newType, int newCondition, string newConditionLabel, double newBound,
string newPrompt )
: taxLabel(newLabel) , shortLabel(newShortLabel) ,
taxRate(newRate) , taxType(newType), conditionType(newCondition),
conditionLabel(newConditionLabel), bound1(newBound) ,
taxPrompt(newPrompt)
{}

tax::tax( string newLabel, string newShortLabel, double newRate, int


newType, int newCondition, string newConditionLabel, double
newLowerBound, double newUpperBound, string newPrompt )
: taxLabel(newLabel) , shortLabel(newShortLabel) ,
taxRate(newRate) , taxType(newType), conditionType(newCondition),

17
National University

conditionLabel(newConditionLabel), bound1(newLowerBound),
bound2(newUpperBound) , taxPrompt(newPrompt)
{}

string tax::getLabel()
{
return taxLabel;
}

string tax::getShortLabel()
{
return shortLabel;
}

double tax::getRate()
{
return taxRate;
}

int tax::getType()
{
return taxType;
}

int tax::getCondition()
{
return conditionType;
}

string tax::getConditionLabel()
{
return conditionLabel;
}

double tax::getTestValue()
{
return bound1;
}

double tax::getLowerBound()
{
return bound1;
}

double tax::getUpperBound()
{
return bound2;
}

18
National University

string tax::getPrompt()
{
return taxPrompt;
}

payscale::payscale()
{}

payscale::payscale(double newRate)
: payRate(newRate), minHours(0)
{}

payscale::payscale(double newRate, double newHours)


: payRate(newRate), minHours(newHours)
{}

double payscale::getMinHours()
{
return minHours;
}

double payscale::getRate()
{
return payRate;
}

employee::employee()
{}

void employee::get_input( vector<tax> taxes )

cout << endl << "Enter the Employee's name (Last, First):" ;
getline( cin, label );

string temp;
cout << endl << endl << "Enter the Number of Hours the Employee has
Worked: ";
cin >> hoursWorked;
getline( cin, temp );

double input;

for ( unsigned int i=0; i < taxes.size(); i++ )


{

input = 0;
tax taxTemp = taxes[i];

19
National University

if (taxTemp.getType() == 3 || taxTemp.getType() == 4)
{

cout << endl << taxTemp.getPrompt();


cin >> input;
getline( cin, temp );

taxInputs.push_back(input);
}

void employee::compute_gross_pay(vector<payscale> payscales)


{
grossPay=0;
double thisScaleHours = 0;

for(unsigned int i=0; i < payscales.size(); i++ )


{

if( i+1 < payscales.size() && hoursWorked >=


payscales[i+1].getMinHours() )
{
thisScaleHours = payscales[i+1].getMinHours() -
payscales[i].getMinHours();
}
else
{
thisScaleHours = hoursWorked -
payscales[i].getMinHours();
}
if(thisScaleHours <= 0)
{
break;
}
grossPay += ( thisScaleHours * payscales[i].getRate() );
}
}

void employee::compute_withholding( vector<tax> taxes )

{
double thisDeduction;
bool doTax = false;

for( unsigned int i = 0; i < taxes.size(); i++ )

20
National University

{
doTax = false;
tax taxTemp = taxes[i];

if( taxTemp.getType() == 3 || taxTemp.getType() == 4 )


{

if( taxTemp.getCondition()==1 )
{
if( taxInputs[i] < taxTemp.getTestValue() )
{
doTax = true;
}
}
else if( taxTemp.getCondition()==2 )
{
if( taxInputs[i] <= taxTemp.getTestValue() )
{
doTax = true;
}
}
else if( taxTemp.getCondition()==3 )
{
if( taxInputs[i] == taxTemp.getTestValue() )
{
doTax = true;
}
}
else if( taxTemp.getCondition()==4 )
{
if( taxInputs[i] > taxTemp.getTestValue() )
{
doTax = true;
}
}
else if( taxTemp.getCondition()==5 )
{
if( taxInputs[i] >= taxTemp.getTestValue() )
{
doTax = true;
}
}
else if( taxTemp.getCondition()==6 )
{
if( taxTemp.getLowerBound() <= taxInputs[i] &&
taxInputs[i] <= taxTemp.getUpperBound() )
{
doTax = true;
}

21
National University

}
else if( taxTemp.getCondition()==7 )
{
if( taxTemp.getLowerBound() < taxInputs[i] &&
taxInputs[i] < taxTemp.getUpperBound() )
{
doTax = true;
}
}
else if( taxTemp.getCondition()==8 )
{
if( taxTemp.getLowerBound() <= taxInputs[i] &&
taxInputs[i] < taxTemp.getTestValue() )
{
doTax = true;
}
}
else if( taxTemp.getCondition()==9 )
{
if( taxTemp.getLowerBound() < taxInputs[i] &&
taxInputs[i] <= taxTemp.getTestValue() )
{
doTax = true;
}
}
else
{
cout << "Error in tax engine - Invalid tax
condition\nPlease check tax definitions or contact software vendor.";
exit(1);
}
}

switch (taxTemp.getType())
{
case 3:
if(doTax == false)
{
thisDeduction=0;
break;
}
case 1:
thisDeduction = taxTemp.getRate();
break;
case 4:
if(doTax == false)
{
thisDeduction=0;
break;

22
National University

}
case 2:
thisDeduction = taxTemp.getRate() * grossPay;
break;
default:
cout << "Error in tax engine - Invalid tax type
\nPlease correct tax structure or contact software vendor." << endl;
exit(1);
}
deductions.push_back(thisDeduction);
}

void employee::compute_net_pay()

{
netPay = grossPay;

for( int i=0; i < deductions.size(); i++)


{
netPay -= deductions[i];
}
}

void employee::display( int displayMode, vector<tax> taxes )

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

if( displayMode == 1 )
{
cout << endl << endl;
cout <<
"_____________________________________________________________"<<endl;
cout << "Employee Name: "<< label << endl << endl;

cout << "Hours Worked: " << hoursWorked<<" hour/s" << endl;
for( int i=0; i < taxes.size(); i++)
{
if( taxes[i].getType() == 3 || taxes[i].getType() == 4 )
{
cout << taxes[i].getConditionLabel() << ": " <<
taxInputs[i] << endl;
}

23
National University

}
cout << endl;

cout << "Employee Gross Pay: Php." << grossPay << endl;
cout << "Deductions:"<<endl;
tax taxTemp;
for( int i=0; i < taxes.size(); i++)
{
taxTemp = taxes[i];
if(deductions[i] == 0.0)
continue;

if( taxTemp.getType() == 1 || taxTemp.getType() == 3 )


{
cout << " -Php." << deductions[i] << " " <<
taxTemp.getLabel() << endl;
}
else
{
cout << " -Php." << deductions[i] << " " <<
taxTemp.getLabel() << " (" << (taxTemp.getRate() * 100) << "%)" << endl;
}
}
cout << endl << "Employee Net Pay: Php." << netPay << endl;
cout <<
"_____________________________________________________________"<<endl;
}

if( displayMode == 2 )
{

cout << label;

if( label.length() < 4 )


{
cout << "\t\t\t\t";
}
else if(label.length() < 12)
{
cout << "\t\t\t";
}
else if(label.length() <= 16)
{
cout << "\t\t";
}
else if(label.length() <= 20)
{
cout << "\t";
}

24
National University

if( grossPay > 99999.9 )


{
cout << grossPay << "\t";
}
else
{
cout << grossPay << "\t\t";
}

for( int i=0; i < deductions.size(); i++)


{
if( deductions[i] > 9999.9 )
{
cout << deductions[i] << "\t";
}
else
{
cout << deductions[i] << "\t\t";
}
}

cout << netPay << endl;


}

bool employee::is_matched( string queryName )


{
if( queryName == label )
return true;
return false;
}

string employee::getLabel()
{
return label;
}

database::database()
{}

void database::addEmployee( vector<tax> taxes, vector<payscale> payscales


)

25
National University

employee newEmployee = employee();


newEmployee.get_input(taxes);
newEmployee.compute_gross_pay(payscales);
newEmployee.compute_withholding(taxes);
newEmployee.compute_net_pay();

employees.push_back( newEmployee );

void database::sort( int sortType )

if( sortType == 1 )
{

for(int i=0; i < employees.size(); i++)


{
int lowestIndex = i;
for( int j=(i+1); j < employees.size(); j++)
{
if(employees[lowestIndex].getLabel() >
employees[j].getLabel())
{
lowestIndex = j;
}

}
if( i != lowestIndex )
{
swap( employees[i], employees[lowestIndex] );
}
}
}

else if( sortType == 2 )


{

for(int i=0; i < employees.size(); i++)


{
int highestIndex = i;
for( int j=(i+1); j > employees.size(); j++)
{
if(employees[highestIndex].getLabel() >
employees[j].getLabel())
{

26
National University

highestIndex = j;
}

}
if( i != highestIndex )
{
swap( employees[i], employees[highestIndex] );
}
}
}

else
{
cout << "Error in sorting engine - Invalid sort type. Please
contact software vendor." << endl;
exit(1);
}
}

void database::print( int indexNumber, vector<tax> taxes )

{
employees[indexNumber].display(1,taxes);
}

void database::print( string queryName, vector<tax> taxes )


{
for( int i=0; i < employees.size(); i++ )
{
if(employees[i].is_matched(queryName))
{
employees[i].display(1,taxes);
break;
}

if( i == employees.size() - 1 )
{
cout << "Employee \"" << queryName << "\" not found.
Please try another name." << endl << endl;
}

}
}

void database::printAll( vector<tax> taxes )


{

string divider;

27
National University

cout << "Name" << "\t";


divider = "----------------------------";

cout << "GrossPay" <<"\t";


divider += "----------------";

for(int i=0; i < taxes.size(); i++)


{
cout << taxes[i].getShortLabel() << "\t";
divider += "----------------";
}

cout << "NetPay" << "\t";


divider += "----------------";

cout << endl;


cout << divider << endl;

for(int i=0; i < employees.size(); i++)


{
employees[i].display(2,taxes);
}

int database::getNumEmployees()
{
return(employees.size());
}

string database::getLabel()
{
return dbLabel;
}

void database::swap( employee& x1, employee& x2 )


{
employee temp;
temp = x1;
x1 = x2;
x2 = temp;
}

28
National University

REFERENCES:
http://www.universalclass.com/articles/business/software-used-for-payroll-man

https://bizfluent.com/list-6755547-objectives-payroll-system.html

https://yourbusiness.azcentral.com/payroll-goals-objectives-12565.html

29

You might also like