0% found this document useful (0 votes)
18 views

Employee Management System Document part

The document outlines the design and implementation of an Employee Management System using Java Swing for the front end and MySQL for the back end. It details the system's objectives, user interactions, database design, and Java code structure, emphasizing its functionality for managing employee records efficiently. The conclusion highlights the system's effectiveness in automating employee data management while providing a user-friendly interface.

Uploaded by

maxpuhan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Employee Management System Document part

The document outlines the design and implementation of an Employee Management System using Java Swing for the front end and MySQL for the back end. It details the system's objectives, user interactions, database design, and Java code structure, emphasizing its functionality for managing employee records efficiently. The conclusion highlights the system's effectiveness in automating employee data management while providing a user-friendly interface.

Uploaded by

maxpuhan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

TABLE OF CONTENTS

1. Introduction ……………………………………………………………………………………………… 2
2. Objective ……………………………………………………………………………………………… 2
3. Tools Used ………………………………………………………………………………………………. 2
4. Database Design …………………………………………………………………………………………… 2
5. User Interface Design …………………………………………………………………………………… 3
6. Java Code Implementation …………………………………………………………………………… 6
7. Output Screenshots ………………………………………………………………………………….. 12
8. Conclusion ……………………………………………………………………………………………… 17
9. References ……………………………………………………………………………………………… 18

1|Page
1. INTRODUCTION
The Employee Management System aims to simplify the process of managing employee
information in an organization. It allows administrators to store, update, and retrieve
employee details efficiently. Built using Java Swing for the front end and MySQL for the back
end, the system provides a reliable solution to handle employee data.

2. OBJECTIVE
The primary objective of the Employee Management System is to streamline the process
of managing employee information within an organization. The system ensures accurate and
efficient handling of employee records and is intended for use by administrators and HR
personnel.

Interactors

 Administrators: Responsible for adding new employee records, updating details like
branch or designation, and removing outdated records when necessary.
 HR Personnel: Access employee details for administrative and organizational
purposes.
 Employees: Have their information securely stored and easily retrievable.

Functions

 Registration: Allows the administrator to add new employee details, including


Employee ID, Name, Monthly Fee, Gender, Branch ID, and Date of Joining (DOJ).
 Deletion: Enables the removal of employee records based on their Employee ID.
 Update: Facilitates updating details such as branch or designation for an existing
employee.
 Display: Provides a way to view all stored employee records in a structured format.

3. Tools Used

NetBeans IDE 8.0: A robust development environment used for coding the Java application.
For front-end design JAVA Swing has been used.

MySQL Command Line Client: A tool for creating and managing the database for backend
design, executing SQL queries, and maintaining the data.

4. Database Design
This section describes the table structure, including field names, data types, and constraints.

Table Schema:

2|Page
Table Name: Students

Field Type Null Key Default Extra

ID int(11) NO PRI NULL auto_increment

name varchar(100) YES NULL

Designation varchar(10) YES NULL

Department varchar(10) YES NULL

Contact varchar(15) YES NULL

Students Table:
"CREATE TABLE IF NOT EXISTS employees (" +
"id INT PRIMARY KEY AUTO_INCREMENT, " +
"name VARCHAR(100), " +
"designation VARCHAR(100), " +
"department VARCHAR(100), " +
"contact VARCHAR(15));";
5. User Interface (GUI) Design
Employee Registration:

3|Page
4|Page
Delete Employee:

Update Designation:

Show Employees:

5|Page
6. Java Code Implementation:
The Java code is structured into different modules for better readability and maintainability.
Key modules include:

 Database Connection: Establishing and managing the connection to the MySQL


database.
 CRUD Operations: Implementation of Create, Read, Update, and Delete
functionalities.
 User Interface: Handling user interactions and displaying data.

package employeemanagement;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
/**
*
* @author hp
*/
public class EmployeeManagement extends JFrame {
/**
* @param args the command line arguments
*/
private Connection connection;
private JTextArea displayArea;
public EmployeeManagement() {
setTitle("Employee Management System");
setSize(600, 400);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
// Establish database connection
connectToDatabase();

6|Page
// Layout
setLayout(new BorderLayout());
// Buttons
JPanel buttonPanel = new JPanel();
JButton registerButton = new JButton("Register Employee");
JButton deleteButton = new JButton("Delete Employee");
JButton updateButton = new JButton("Update Designation");
JButton showAllButton = new JButton("Show All Employees");
buttonPanel.add(registerButton);
buttonPanel.add(deleteButton);
buttonPanel.add(updateButton);
buttonPanel.add(showAllButton);
// Display Area
displayArea = new JTextArea();
displayArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(displayArea);
add(buttonPanel, BorderLayout.NORTH);
add(scrollPane, BorderLayout.CENTER);
// Button Actions
registerButton.addActionListener(e -> registerEmployee());
deleteButton.addActionListener(e -> deleteEmployee());
updateButton.addActionListener(e -> updateEmployee());
showAllButton.addActionListener(e -> showAllEmployees());
}
private void connectToDatabase() {
try {
// Load JDBC driver
// Connect to database
String driver="com.mysql.jdbc.Driver";

7|Page
String url="jdbc:mysql://localhost:3306/Employee_DB";
String username="root";
String password="root";
Class.forName(driver);
connection = DriverManager.getConnection(url, username, password);
// Ensure table exists
String createTableSQL = "CREATE TABLE IF NOT EXISTS employees (" +
"id INT PRIMARY KEY AUTO_INCREMENT, " +
"name VARCHAR(100), " +
"designation VARCHAR(100), " +
"department VARCHAR(100), " +
"contact VARCHAR(15));";
Statement statement = connection.createStatement();
statement.executeUpdate(createTableSQL);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Database Connection Failed: " +
e.getMessage());
System.exit(0);
}
}
private void registerEmployee() {
try {
String name = JOptionPane.showInputDialog(this, "Enter Employee Name:");
String designation = JOptionPane.showInputDialog(this, "Enter Designation:");
String department = JOptionPane.showInputDialog(this, "Enter Department:");
String contact = JOptionPane.showInputDialog(this, "Enter Contact Number:");
String insertSQL = "INSERT INTO employees (name, designation, department, contact)
VALUES (?, ?, ?, ?);";
PreparedStatement preparedStatement = connection.prepareStatement(insertSQL);
preparedStatement.setString(1, name);

8|Page
preparedStatement.setString(2, designation);
preparedStatement.setString(3, department);
preparedStatement.setString(4, contact);
preparedStatement.executeUpdate();
JOptionPane.showMessageDialog(this, "Employee Registered Successfully!");
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Error: " + e.getMessage());
}
}
private void deleteEmployee() {
try {
int id = Integer.parseInt(JOptionPane.showInputDialog(this, "Enter Employee ID to
Delete:"));
String deleteSQL = "DELETE FROM employees WHERE id = ?;";
PreparedStatement preparedStatement = connection.prepareStatement(deleteSQL);
preparedStatement.setInt(1, id);
int rowsAffected = preparedStatement.executeUpdate();
if (rowsAffected > 0) {
JOptionPane.showMessageDialog(this, "Employee Deleted Successfully!");
} else {
JOptionPane.showMessageDialog(this, "Employee Not Found!");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Error: " + e.getMessage());
}
}
private void updateEmployee() {
try {
int id = Integer.parseInt(JOptionPane.showInputDialog(this, "Enter Employee ID to
Update:"));

9|Page
String newDesignation = JOptionPane.showInputDialog(this, "Enter New
Designation:");
String updateSQL = "UPDATE employees SET designation = ? WHERE id = ?;";
PreparedStatement preparedStatement = connection.prepareStatement(updateSQL);
preparedStatement.setString(1, newDesignation);
preparedStatement.setInt(2, id);
int rowsAffected = preparedStatement.executeUpdate();
if (rowsAffected > 0) {
JOptionPane.showMessageDialog(this, "Employee Updated Successfully!");
} else {
JOptionPane.showMessageDialog(this, "Employee Not Found!");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Error: " + e.getMessage());
}
}
private void showAllEmployees() {
try {
String selectSQL = "SELECT * FROM employees;";
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(selectSQL);
StringBuilder sb = new StringBuilder();
sb.append("ID\tName\tDesignation\tDepartment\tContact\n");
sb.append("------------------------------------------------------------------------------------------\n");
while (resultSet.next()) {
sb.append(resultSet.getInt("id")).append("\t")
.append(resultSet.getString("name")).append("\t")
.append(resultSet.getString("designation")).append("\t")
.append(resultSet.getString("department")).append("\t")
.append(resultSet.getString("contact")).append("\n");

10 | P a g e
}
displayArea.setText(sb.toString());
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Error: " + e.getMessage());
}
}
public static void main(String[] args) {
// TODO code application logic here
SwingUtilities.invokeLater(() -> {
new EmployeeManagement().setVisible(true);
});
}

11 | P a g e
7. OUTPUTS
Main Menu
This is the entry point of the system where users can select options like adding, updating,
deleting, or viewing student records.

Registration Form
This form allows users to register a new Employee by entering their required fields.

12 | P a g e
13 | P a g e
Update Form
This screen is used for modifying the details of an existing Employee, such as changing their
Designation.

14 | P a g e
15 | P a g e
Delete Form
This screen is used to delete an existing employee.

16 | P a g e
Display of Employee Records
This output displays the list of all registered employee, including their ID, name,
Designation, Department and contact information.

8. Conclusion
The Employee Management System effectively automates the process of managing
employee data, ensuring accuracy and saving time. It offers a user-friendly interface and
robust backend support, making it a practical solution for organizations.

17 | P a g e
9. References
a. “Loy, M., Eckstein, R., Wood, D., Elliott, J., & Cole, B. (2002). Java swing. " O'Reilly Media,
Inc.".
b. Walrath, Kathy. The JFC Swing tutorial: a guide to constructing GUIs. Addison-Wesley
Professional, 2004.
c. Singh, Ravi Kumar, et al. "Development of Student Result Management System Using
Java as Backend." International Journal of Communication Networks and Information
Security (IJCNIS) 16.1 (2024): 1109-1121.Design Patterns for GUI (Head First Design
Patterns): O'Reilly Media
d. Devi, Savita. "Analysis with performance of computer based scholar management
system." Global Sci-Tech 10.3 (2018): 125-131.
e. GeeksforGeeks - Java Programming: GeeksforGeeks - Java Programming
f. Sheldon, Robert, and Geoff Moes. Beginning MySQL. John Wiley & Sons, 2005.

18 | P a g e

You might also like