Wa0058.
Wa0058.
PROJECT
TOPIC: EMPLOYEE
MANAGMENT
MADE BY:
MRIGANK ABHISHEK AND GAURAV BISHT
CLASS: XII-B
SCHOOL: KENDRIYA VIDYALAYA NO.-1 A.F.S
HINDAN G.Z.B
CERTIFICATE
This is to certify that Mrigank Abhishek and Gaurav Bisht of
class XII-B has satisfactorily completed their Computer
Science Project on the topic Employee Management during
the academic year 2021-22.
.
ACKNOWLEDGEMENT
We would like to express our thanks and gratitude to our
project guide Ms. Renu Singh Mam for guiding us
immensely through the course of the project. She always
took a keen interest in our work and motivated us to do
better. We also thank the Computer Science Department
of our school for providing us with all the facilities and
support required. Our sincere gratitude to all those who
directly and indirectly helped us in the successful
completion of this project.
CONTENTS
CERTIFICATE
DECLARATION
ACKNOWLEDGEMENT
OVERVIEW
PROJECT SORCE CODE
OUTPUT
TKINTER OPENING SCREEN
ACCEPT INPUT FOR NEW EMPLOYEE
DISPLAY ALL EMPLOYEES INFORMATION
REMOVE EMPLOYEE DETAILS
EXIT THE PROGRAM
CONCLUSION
BIBLOGRAPHY
OVERVIEW
In this project we have created fully functioning
“Employee Management System”. This program is capable
of performing multiple tasks like: - Adding, Deleting,
Displaying, and Removing information about the employee.
class Employee(object):
def __init__(self, emp_id, emp_name, emp_address, emp_post, emp_age):
self.__employee_id = emp_id
self.__employee_name = emp_name
self.__employee_address = emp_address
self.__employee_post = emp_post
self.__employee_age = emp_age
def get_name(self):
return self.__employee_name
def __str__(self):
emp = f"Employee Id: {self.__employee_id}"
emp += f"\nEmployee Name: {self.__employee_name}"
emp += f"\nEmployee Address: {self.__employee_address}"
emp += f"\nEmployee Post: {self.__employee_post}"
emp += f"\nEmployee Age: {self.__employee_age}"
return emp
class FullTimeEmployee(Employee):
def __init__(self, emp_id, emp_name, emp_address, post, emp_age, salary):
super().__init__(emp_id, emp_name, emp_address, post, emp_age)
self.__emp_salary = salary
def __str__(self):
childData = super().__str__()
childData = f"\n\n***Employee Details***\n{childData}"
childData += f"\n\n***Full Time Employee***"
childData += f"\nSalary: {self.__emp_salary}"
return childData
class HourlyEmployee(Employee):
def __init__(self,emp_id, emp_name, emp_address, post, emp_age, hoursWorked,
hourlyRate):
super().__init__(emp_id, emp_name, emp_address, post, emp_age)
self.__emp_hoursWorked = hoursWorked
self.__emp_hourlyRate = hourlyRate
def __str__(self):
childData = super().__str__()
childData = f"\n\n***Employee Details***\n{childData}"
childData += f"\n\n***Hourly Rate Employee***"
childData += f"\nHours Worked: {self.__emp_hoursWorked}"
childData += f"\nHourly Rate: {self.__emp_hourlyRate}"
return childData
class Consultant(Employee):
def __str__(self):
childData = super().__str__()
childData = f"\n\n***Employee Details***\n{childData}"
childData += f"\n\n***Consultant***"
childData += f"\nHours Worked: {self.__emp_hoursWorked}"
return childData
def main():
emp_data_list = read_file_data()
sel = 1
def read_file_data():
my_lst = []
try:
fb = open('empdata.dat', 'rb')
except FileNotFoundError:
return my_lst
else:
try:
while (True):
my_lst.append(pickle.load(fb))
except EOFError:
fb.close()
return my_lst
def run_option1(mydb):
sel = 0
if sel == 1:
sal = get_fulltimeemployee_input()
result = FullTimeEmployee(emp_id, emp_name, emp_address, emp_post,emp_age, sal)
elif sel == 2:
hoursWorked, hourlyRate = get_hourlyemployee_input()
result = HourlyEmployee(emp_id, emp_name, emp_address, emp_post, emp_age,
hoursWorked, hourlyRate)
elif sel == 3:
hoursWorked = get_consultant_input()
result = Consultant(emp_id, emp_name, emp_address, emp_post, emp_age,
hoursWorked)
return result
'''
Display employee information (including vehicle information) for all the employees that are
there in the system.
'''
def run_option2():
print("-----------------------------")
my_lst = read_file_data()
for ele in my_lst:
print(ele)
print("-----------------------------")
'''
List the name of the Employees along with the compensation received by each.
'''
def run_option3():
fb = read_file_data()
emp_name = input('Enter the Employee Name to be removed: ')
flag = False
if(len(fb) != 0):
print("-----------------------------")
for _ in fb:
if _.get_name()==emp_name:
fb.remove(_)
flag = True
break
if (flag):
print("Employee Removed")
else:
print("Employee Not Found")
file = open('empdata.dat', 'wb')
for obj in fb:
pickle.dump(obj, file)
file.close()
else:
print("File empty!")
def run_option4(my_lst):
print("You chose to exit the program")
yes_no = input("Are you sure (Y/N)? ")
if yes_no.lower() == 'y':
fb = open('empdata.dat', 'wb')
for obj in my_lst:
pickle.dump(obj, fb)
fb.close()
print('Execution stopped!')
sys.exit()
else:
print('Execution not stopped.')
def get_emp_input(mydb):
emp_id = input('Enter the Employee Id: ')
emp_name = input('Enter the Employee Name: ')
emp_address = input('Enter the Address: ')
emp_post = input('Enter the Employee Post: ')
emp_age = input('Enter the Employee Age: ')
query ="insert into employee (id,name,address,post,age) values (%s,%s,%s,%s,%s)"
emp_details = (emp_id, emp_name, emp_address, emp_post, emp_age)
mycursor = mydb.cursor()
mycursor.execute(query, emp_details)
mydb.commit();
return (emp_id, emp_name, emp_address, emp_post, emp_age)
def get_fulltimeemployee_input():
err_flg = True
while err_flg:
try:
sal = float(input('Enter the salary: '))
except ValueError:
print('\nEnter a numerical value for salary!')
else:
err_flg = False
return (sal)
def get_hourlyemployee_input():
err_flg = True
while err_flg:
try:
hoursWorked = int(input('Enter the hours worked: '))
except ValueError:
print('Enter a integer value for hours worked!')
try:
hourlyRate = float(input('Enter the hourly rate: '))
except ValueError:
print('Enter a numeric value for salary!')
else:
err_flg = False
err_flg = True
def get_consultant_input():
err_flg1 = True
while err_flg1:
try:
hoursWorked = int(input('Enter the hours worked: '))
except ValueError:
print('Enter a integer value for hours worked!')
else:
err_flg1 = False
err_flg1 = True
return (hoursWorked)
main()
OUTPUT
TKINTER OPENING
SCREEN
https://docs.python.org/3/library/tkinter.html
https://docs.python.org/3/library/pickle.html