0% found this document useful (0 votes)
6 views2 pages

Employee Management System in Python

The document defines an Employee class in Python with attributes such as emp_ID, name, position, salary, department, and status. It includes methods for copying an employee, promoting, terminating, reactivating, applying bonuses, and displaying employee information. The document also demonstrates the creation and manipulation of employee instances.

Uploaded by

bernardocyrus222
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Employee Management System in Python

The document defines an Employee class in Python with attributes such as emp_ID, name, position, salary, department, and status. It includes methods for copying an employee, promoting, terminating, reactivating, applying bonuses, and displaying employee information. The document also demonstrates the creation and manipulation of employee instances.

Uploaded by

bernardocyrus222
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Cyrus A.

Bernardo
BSIT 2-C
class Employee:
def __init__(self, emp_ID, name, position, salary, department, status):
self.emp_ID = emp_ID
[Link] = name
[Link] = position
[Link] = salary
[Link] = department
[Link] = status

def copy(self):
return Employee(self.emp_ID, [Link], [Link], [Link], [Link],
[Link])

def promote(self, new_position, increase):


[Link] = new_position
[Link] += increase
print("Employee has been promoted.")

def terminate(self):
[Link] = "Inactive"
print(f"{[Link]} is now Inactive.")

def reactivate(self):
[Link] = "Active"
print(f"{[Link]} is reactivated.")

def apply_bonus(self, percent):


if [Link] == "Inactive":
print("\nbonus does not apply to an inactive employee.")
print("=" *145 + "\n")
elif 1 <= percent <= 20:
[Link] += [Link] * (percent / 100)
print("Bonus applied successfully.")

def display_info(self):
print(f"\nID: {self.emp_ID}")
print(f"Name: {[Link]}")
print(f"Position: {[Link]}")
print(f"Department: {[Link]}")
print(f"Salary: ₱{[Link]}")
print(f"Status: {[Link]}")

emp1 = Employee(0, "Kristann", "Staff", 0, "General", "Active")


emp1.display_info()

emp2 = Employee(101, "Ross", "Manager", 120000, "Finance", "Active")


Cyrus A. Bernardo
BSIT 2-C
emp2.display_info()

emp3 = [Link]()
[Link] = "Oro"
emp3.display_info()
print()
[Link]("CEO", 5000)
print()
[Link]()
print()
[Link]("Director", 30000)
print()
emp3.apply_bonus(15)
print()
[Link]()
print()
emp2.apply_bonus(15)
print()
emp1.display_info()
emp2.display_info()
emp3.display_info()

You might also like