Professional Documents
Culture Documents
Java Project Report On Employee Management System
Java Project Report On Employee Management System
MEMBERS:
SUBMITTED TO: -
“SCHOOL OF COMPUTER SCIENCE AND ENGENEERING”
INTRODUCTION
Efficiency: The system aims to automate and simplify the complex and
time-consuming process of calculating and managing employee salaries,
wages, taxes, and other compensation-related expenses. It reduces the
manual effort involved in payroll processing, minimizes the risk of errors,
and improves overall efficiency in managing payroll tasks.
Java offers a rich set of libraries and frameworks that provide extensive
functionality for tasks such as graphical user interface (GUI) development,
networking, database connectivity, multithreading, and more. Java also
supports concurrent programming, allowing developers to write efficient and
scalable applications that can handle multiple tasks simultaneously.
SOURCE CODE
EMPLOYEE CLASS :
public class Employee {
private String name;
private double salary;
private double taxRate;
private double niRate;
private double taxPaid;
PAYROLLSYSTEM CLASS :
import java.util.*;
import java.io.*;
public PayrollSystem() {
employees = new ArrayList<Employee>();
}
while (true) {
System.out.println("Enter a operation:");
System.out.println("1. Add Employee");
System.out.println("2. Delete Employee");
System.out.println("3. Display Pay Slip");
System.out.println("4. Save to File");
System.out.println("5. Exit");
System.out.println("========================================");
System.out.println("Enter a choice:");
int choice = scanner.nextInt();
scanner.nextLine();
System.out.println("========================================");
if (choice == 1) {
System.out.print("Enter name of employee: ");
String name = scanner.nextLine();
System.out.print("Enter salary of employee: ");
double salary = scanner.nextDouble();
System.out.print("Enter tax rate of employee (in decimal): ");
double taxRate = scanner.nextDouble();
System.out.print("Enter National Insurance Rate of employee (in decimal[0.x]): ");
double niRate = scanner.nextDouble();
Employee employee = new Employee(name, salary, taxRate, niRate);
payrollSystem.addEmployee(employee);
System.out.println("Employee added successfully.");
} else if (choice == 2) {
System.out.print("Enter name of employee to delete: ");
String name = scanner.nextLine();
payrollSystem.deleteEmployee(name);
System.out.println("Employee deleted successfully.");
} else if (choice == 3) {
System.out.print("Enter name of employee to display pay slip: ");
String name = scanner.nextLine();
System.out.println("========================================");
payrollSystem.displayPaySlip(name);
System.out.println("========================================");
} else if (choice == 4) {
payrollSystem.saveEmployeesToFile();
System.out.println("Data saved to file.");
} else if (choice == 5) {
payrollSystem.saveEmployeesToFile();
System.out.println("Data saved to file.");
System.out.println("Exiting...");
break;
} else {
System.out.println("Invalid choice. Please try again.");
}
}
scanner.close();
}
}
TERMINAL OUTPUT :
Enter a operation:
1. Add Employee
2. Delete Employee
3. Display Pay Slip
4. Save to File
5. Exit
========================================
Enter a choice:
1
========================================
Enter name of employee: Mungeri Lal
Enter salary of employee: 50000
Enter tax rate of employee (in decimal): 5
Enter National Insurance Rate of employee (in decimal[0.x]): 0.9
Employee added successfully.
Enter a operation:
1. Add Employee
2. Delete Employee
3. Display Pay Slip
4. Save to File
5. Exit
========================================
Enter a choice:
3
========================================
Enter name of employee to display pay slip: Mungeri Lal
========================================
<< Name: Mungeri Lal|| Gross Pay: 50000.0|| Net Pay: 47050.0 >>
========================================
Enter a operation:
1. Add Employee
2. Delete Employee
3. Display Pay Slip
4. Save to File
5. Exit
========================================
Enter a choice:
5
========================================
Data saved to file.
Exiting...
Screenshots of Output:
Content in Employees.txt after operations:
CONSLUSION
In conclusion, the code demonstrates the use of a Payroll class to generate pay
slips for employees. Two employee objects, employee1 and employee2, are
created with their respective details such as name, address, salary, and tax
deductions. These employee objects are then added to the payroll using the
addEmployee() method. The generatePaySlips() method is called on the payroll
object to generate an ArrayList of PaySlip objects, which contain information
such as the employee name, gross pay, tax deduction, national insurance
deduction, and net pay. Finally, a loop iterates through the pay slips and prints
out the details of each pay slip using the get methods of the PaySlip class. This
code showcases an example of how a payroll system can be implemented in
Java using classes and objects.
the PayrollSystem class is a Java program that provides functionality for
managing employees' payroll information. It allows users to add employees,
delete employees, display pay slips, and save employee data to a file. The
program makes use of a list to store employee objects and reads from and
writes to a text file for persistence of employee data.
The program also handles exceptions, such as FileNotFoundException and
IOException, which may occur when reading from or writing to the employee
data file. The PayrollSystem class uses try-with-resources to properly manage
resources such as FileReader, BufferedReader, FileWriter, and PrintWriter to
ensure efficient and safe handling of file operations.