A Java-based Employee Payroll System to manage employee records, calculate salaries, and generate payslips efficiently. It is an Offline CLI Application.
- Add, update, and manage employee details
- Calculate monthly payroll automatically
- Generate payslips for employees
- Connects to MySQL database for persistent storage
- Java JDK 8 or higher
- MySQL database
- MySQL Connector/J (
mysql-connector-j-9.4.0.jar
included inlib/
)
ace5fd2ad6cc2581f9fceda2e1bd74c92f054447 CREATE TABLE employees ( id VARCHAR(20) PRIMARY KEY, name VARCHAR(100) NOT NULL, position VARCHAR(100), basic_salary DECIMAL(10,2) );
CREATE TABLE attendance (
id INT AUTO_INCREMENT PRIMARY KEY,
emp_id VARCHAR(20),
date DATE NOT NULL,
is_present BOOLEAN DEFAULT FALSE,
overtime_hours DECIMAL(5,2) DEFAULT 0.00,
FOREIGN KEY (emp_id) REFERENCES employees(id),
UNIQUE KEY unique_attendance (emp_id, date)
);
String url = "jdbc:mysql://localhost:3306/payroll_db";
String username = "root"; // your MySQL username
String password = "password"; // your MySQL password
- Open terminal/PowerShell in the
src/
folder. - Compile all Java files:
javac -cp ".;..\lib\mysql-connector-j-9.4.0.jar" *.java
java -cp ".;..\lib\mysql-connector-j-9.4.0.jar" PayrollSystem
ace5fd2ad6cc2581f9fceda2e1bd74c92f054447