A console-based Core Java application that manages employee records, calculates salaries, generates salary slips, and stores employee data using CSV file handling.
- Add Employee
- View All Employees
- Search Employee by ID
- Generate Salary Slip
- Calculate Tax Deduction
- Save Employee Data to CSV File
- Load Employee Data from CSV File
Salary Formula:
Net Salary = (Basic Salary + Bonus) - Tax
Salary Formula:
Net Salary = (Hourly Rate × Hours Worked) - Tax
Salary Formula:
Net Salary = Contract Amount - Tax
- Object-Oriented Programming (OOP)
- Abstraction
- Interfaces
- Inheritance
- Polymorphism
- Encapsulation
- Collections Framework
- Java 8 Streams
- Exception Handling
- File Handling (CSV)
EmployeePayrollSystem/
│
├── employees.csv
├── out/
├── src/
│ ├── Main.java
│ │
│ ├── model/
│ │ ├── Employee.java
│ │ ├── FullTimeEmployee.java
│ │ ├── PartTimeEmployee.java
│ │ ├── ContractEmployee.java
│ │ └── Taxable.java
│ │
│ ├── service/
│ │ ├── PayrollService.java
│ │ └── FileService.java
│ │
│ └── exception/
│ └── PayrollException.java
- Java
- Java Collections Framework
- Java Streams API
- File Handling
- CSV Storage
Open terminal inside the project folder and run:
javac -d out src/Main.java src/model/*.java src/service/*.java src/exception/*.javajava -cp out Main===== Employee Payroll System =====
1. Add Employee
2. View All Employees
3. Search Employee by ID
4. Generate Salary Slip
5. Calculate Tax for Employee
6. Save Data to File
7. Load Data from File
8. Exit
===================================
Employee data is stored in:
employees.csv
Example:
FULLTIME,E001,Ajay,Research And Development,50000.0,5000.0
PARTTIME,E002,Rahul,IT,200.0,80.0
CONTRACT,E003,Aman,Finance,80000.0
==============================
SALARY SLIP
ID : E001
Name : Ajay
Dept : Research And Development
Type : Full-Time
Gross : ₹55000.0
Tax : ₹5500.0
Net : ₹49500.0
==============================
The application handles:
- Duplicate Employee IDs
- Employee Not Found
- Invalid Menu Inputs
- File Handling Errors
using a custom exception:
PayrollException
- Java Swing / JavaFX GUI
- MySQL or SQLite Database Integration
- JDBC Connectivity
- Login Authentication System
- Admin Dashboard
- JUnit Testing
Developed a console-based Employee Payroll Management System using Core Java, OOP principles, Collections Framework, Java Streams, and File Handling. Implemented role-based salary calculation, tax deduction, employee record management, salary slip generation, and CSV-based data persistence.
Ajay Razz
Open terminal inside your project folder.
Example:
cd EmployeePayrollSystemCompile the project:
javac -d out src/Main.java src/model/*.java src/service/*.java src/exception/*.javaRun the application:
java -cp out MainAfter running, you will see:
===== Employee Payroll System =====
1. Add Employee
2. View All Employees
3. Search Employee by ID
4. Generate Salary Slip
5. Calculate Tax for Employee
6. Save Data to File
7. Load Data from File
8. Exit
===================================
Choose:
1
Then select employee type:
1 → Full-Time
2 → Part-Time
3 → Contract
Example:
Choose an option: 1
Choose Employee Type: 1
Enter Employee ID: E001
Enter Name: Ajay
Enter Department: Research And Development
Enter Basic Salary: 50000
Enter Bonus: 5000
After successful entry:
Employee added successfully.
Choose:
2
This prints all employee records currently stored in memory.
Choose:
3
Example:
Enter Employee ID: E001
The application will display employee details if found.
Choose:
4
Example:
Enter Employee ID: E001
Output example:
==============================
SALARY SLIP
ID : E001
Name : Ajay
Dept : Research And Development
Type : Full-Time
Gross : ₹55000.0
Tax : ₹5500.0
Net : ₹49500.0
==============================
Choose:
5
Example:
Enter Employee ID: E001
Output:
Tax for Ajay: ₹5500.0
Choose:
6
This saves all employee records into:
employees.csv
You can also save automatically by choosing:
8 → Exit
because the application auto-saves before closing.
Run this command in terminal:
cat employees.csvExpected output example:
FULLTIME,E001,Ajay,Research And Development,50000.0,5000.0
PARTTIME,E002,Rahul,IT,200.0,80.0
CONTRACT,E003,Aman,Finance,80000.0
Open directly:
open employees.csvOR view in terminal:
cat employees.csvOpen the project folder in VS Code.
Then click:
employees.csv
from the Explorer sidebar.
Choose:
7
This reads employee data from employees.csv and loads it into the application.
The app may also auto-load data when it starts.
Choose:
8
This:
- saves data automatically
- closes the application safely
-
Data is first stored in memory.
-
CSV updates only after:
- Option 6 → Save Data
- Option 8 → Exit
-
Invalid menu choices show:
Invalid option. Try again.
- Employee IDs should be unique.
1 → Add Employee
2 → View Employees
4 → Generate Salary Slip
6 → Save Data
cat employees.csv → Verify CSV
8 → Exit