Skip to content

jananijeev15/Python_Task_07_Janani

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Employee Management System

Project Title

Employee Management System - Python Task 07 (OOP)


Objective

The purpose of this task is to understand and implement Object-Oriented Programming (OOP) concepts in Python by building a menu-driven Employee Management System using Classes and Objects. This system demonstrates real-world application of OOP principles used in enterprise applications.


Features

Core Features (Required)

  1. Employee Class - Defined with attributes: Employee ID, Name, Department, Designation, Salary
  2. Add Employee - Insert new employee records with validation
  3. View All Employees - Display all records in clean tabular format
  4. Search Employee - Search by Employee ID or Name
  5. Update Employee - Modify Department, Designation, or Salary
  6. Delete Employee - Remove employee records by ID
  7. Salary Statistics - Calculate and display:
    • Highest Salary
    • Lowest Salary
    • Average Salary
    • Total Employees
  8. Export Data - Save employee records to:
    • employees.csv (Comma-Separated Values)
    • employees.txt (Text Format)
  9. Read CSV/TXT - Read and display file contents back

Bonus Features (Optional - Implemented)

  • Salary Increment Calculator - Calculate salary increments by percentage
  • Department-wise Employee Count - Show count of employees per department
  • Search by Department - Filter employees by department
  • Sort by Salary - Display employees sorted by salary (highest to lowest)

Technologies Used

  • Language: Python 3.x
  • Concepts:
    • Classes and Objects
    • Constructors (__init__)
    • Methods and Instance Variables
    • Encapsulation
    • Lists of Objects
    • File Handling (CSV, TXT)
    • Exception Handling
    • String Formatting

Program Flow

Initialization

  1. System loads existing employee data from employees.csv (if available)
  2. Sample data is loaded on first run for demonstration

Main Menu Loop

The program displays a menu with 14 options:

1.  Add Employee
2.  View All Employees
3.  Search Employee
4.  Update Employee
5.  Delete Employee
6.  Salary Statistics
7.  Export Data (CSV)
8.  Export Data (TXT)
9.  Read CSV File
10. Salary Increment Calculator (Bonus)
11. Department-wise Employee Count (Bonus)
12. Search by Department (Bonus)
13. Sort Employees by Salary (Bonus)
14. Exit

Detailed Operation Flow

1. Add Employee

  • User inputs: ID, Name, Department, Designation, Salary
  • System validates if Employee ID already exists
  • Creates new Employee object
  • Adds to employee list
  • Saves to CSV automatically
  • Displays success/error message

2. View All Employees

  • Displays all employees in tabular format with columns:
    • ID | Name | Department | Designation | Salary
  • Shows formatted table with borders
  • Handles empty list scenario

3. Search Employee

  • User selects search type (ID or Name)
  • System searches through employee list
  • Displays results in table format if found
  • Shows "Employee Not Found" if no match

4. Update Employee

  • User enters Employee ID
  • System displays current details
  • User selects what to update (Department/Designation/Salary/All)
  • Validates input and updates
  • Saves changes to CSV
  • Displays confirmation

5. Delete Employee

  • User enters Employee ID to delete
  • System asks for confirmation
  • Removes employee from list
  • Saves updated list to CSV
  • Shows success message

6. Salary Statistics

  • Calculates and displays:
    • Maximum salary across all employees
    • Minimum salary across all employees
    • Average salary
    • Total number of employees
  • Presented in formatted box

7-8. Export Data

  • CSV Export: Saves in standard CSV format with headers
  • TXT Export: Saves in formatted text with timestamp and statistics
  • Both include all employee records
  • Automatic file creation/overwrite

9. Read CSV

  • Reads and displays the contents of employees.csv
  • Shows raw file format

10-13. Bonus Features

  • Salary Increment: Calculate new salaries with percentage increase
  • Department Count: Summary of employees per department
  • Search by Department: Filter employees by selected department
  • Sort by Salary: Display employees ranked by salary (highest first)

Challenges Faced

  1. Data Persistence:

    • Challenge: Maintaining employee data between program sessions
    • Solution: Implemented CSV file loading on startup and auto-saving after operations
  2. Input Validation:

    • Challenge: Handling invalid inputs (non-numeric IDs, duplicate IDs, invalid salaries)
    • Solution: Used try-except blocks and validation checks for all user inputs
  3. Tabular Display:

    • Challenge: Formatting employee data in clean, readable columns
    • Solution: Used Python string formatting with fixed column widths
  4. Search Functionality:

    • Challenge: Efficient searching through employee list
    • Solution: Used list comprehension and lambda functions for flexible search
  5. File Handling:

    • Challenge: Reading and writing CSV files with proper formatting
    • Solution: Used Python's csv module with proper encoding (UTF-8)
  6. Update Flexibility:

    • Challenge: Allowing selective updates of employee fields
    • Solution: Implemented conditional update logic with user menu selection

Learning Outcomes

OOP Concepts Mastered

  1. Classes and Objects - Created Employee and EmployeeManagementSystem classes
  2. Constructors - Implemented __init__ for initializing attributes
  3. Methods - Created multiple methods for different operations
  4. Encapsulation - Bundled data and operations within classes
  5. Lists of Objects - Managed collection of Employee objects

Programming Skills Developed

  1. File I/O - Read and write CSV/TXT files
  2. Exception Handling - Try-except blocks for error management
  3. Data Validation - Input checking and error messages
  4. String Formatting - Professional table formatting
  5. Algorithmic Thinking - Search, sort, and statistical calculations
  6. Code Organization - Well-structured, modular code design
  7. User Interface - Menu-driven system with clear prompts

Real-World Applications

  • Foundational understanding of enterprise employee systems
  • Database-like operations (CRUD - Create, Read, Update, Delete)
  • CSV data handling (commonly used in data analysis)
  • Scalable architecture for larger applications

How to Run

Prerequisites

  • Python 3.6 or higher
  • Text editor or IDE (VS Code recommended)

Steps to Execute

  1. Save the file: Save employee_management.py in a folder (e.g., Python_Task_07_YourName)

  2. Open Terminal/Command Prompt in the folder location

  3. Run the program:

    python employee_management.py

    or

    python3 employee_management.py
  4. Follow the menu prompts to perform operations

  5. Exit: Press option 14 to exit the program

File Structure

Python_Task_07_YourName/
├── employee_management.py     # Main program
├── employees.csv              # Auto-generated data file
├── employees.txt              # Auto-generated export file
├── README.md                  # This documentation
└── Screenshots/               # (Optional) Program screenshots
    ├── screenshot1.png
    ├── screenshot2.png
    └── screenshot3.png

Sample Output

Main Menu Display

==================================================
🏢 EMPLOYEE MANAGEMENT SYSTEM
==================================================
1.  Add Employee
2.  View All Employees
3.  Search Employee
...
14. Exit
==================================================

View All Employees Output

===========================================================================
ID       Name                 Department      Designation        Salary    
===========================================================================
101      Soham                IT              Developer          50000.00   
102      Rahul                HR              Manager            65000.00   
103      Priya                Finance         Analyst            55000.00   
===========================================================================

Salary Statistics Output

==================================================
📊 SALARY STATISTICS
==================================================
Highest Salary: ₹75,000.00
Lowest Salary:  ₹45,000.00
Average Salary: ₹58,000.00
Total Employees: 5
==================================================

Key Features Highlights

Professional Design

  • User-friendly menu system
  • Clear error messages
  • Formatted output with proper alignment
  • Unicode symbols for better UX (✅, ❌, 📊, etc.)

🔒 Data Validation

  • Duplicate employee ID prevention
  • Numeric input validation
  • Salary format validation
  • File existence checks

💾 Data Persistence

  • Auto-save to CSV after each operation
  • Load existing data on startup
  • Multiple export formats (CSV, TXT)

Bonus Features

  • Comprehensive salary increment calculations
  • Department analytics
  • Flexible search and sorting
  • Professional report generation

Future Enhancements

Potential improvements for advanced implementation:

  • Database integration (SQLite, MySQL)
  • User authentication system
  • Employee login functionality
  • Advanced reporting and analytics
  • Email notifications
  • Web-based interface
  • Performance optimization for large datasets

Submission Guidelines

  1. Create a folder: Python_Task_07_YourName

  2. Include:

    • employee_management.py (Main program)
    • employees.csv or employees.txt (Sample data)
    • README.md (This documentation)
    • ✅ Screenshots (Optional but recommended)
  3. Upload to GitHub in your internship repository

  4. Submit the GitHub link through the weekly submission form


Topics Covered

  • ✅ Classes and Objects
  • ✅ Constructors (__init__)
  • ✅ Methods and Instance Variables
  • ✅ Object Creation
  • ✅ Encapsulation
  • ✅ Lists of Objects
  • ✅ CSV File Handling
  • ✅ Text File Handling
  • ✅ Exception Handling
  • ✅ Basic OOP Principles

Important Notes

Object-Oriented Programming is the backbone of modern software development. Frameworks like Django, Flask, FastAPI, and many enterprise applications are built using OOP concepts. Mastering these fundamentals will prepare you for building scalable and maintainable applications.


Author

Created as part of White Band Associates - Python Internship Program Task: 07 - Object-Oriented Programming & Employee Management System


License

This project is part of an educational internship program. All rights reserved.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages