Facebook
From Coral Bird, 1 Week ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 69
  1. class Employee:
  2.     def __init__(self):
  3.         self.employees = []
  4.        
  5.     def addEmployee(self,empID, name, jdate, depart, desi, basic, hra, da, it):
  6.         self.employees.append([empID, name, jdate, depart, desi, basic, hra, da, it])
  7.          
  8.     def displayEmp(self, empID=None):
  9.         found = False
  10.         for emp in self.employees:
  11.             if(emp[0] == int(empID)):
  12.                 print ("Employee ID: ", emp[0])
  13.                 print ("Name of Employee is: ", emp[1])
  14.                 print ("Employee Join date: ", emp[2])
  15.                 print ("Department of Employee: ", emp[3])
  16.                 print ("Designation of Employee: ", emp[4])
  17.                 print ("basic of Employee: ", emp[5])
  18.                 print ("hra of Employee: ", emp[6])
  19.                 print ("da of Employee: ", emp[7])
  20.                 print ("it of Employee: ", emp[8])
  21.                 found = True        
  22.                 return True
  23.         if(found==False):
  24.             print(f"{empID} - Employee not found in the database !!!!")
  25.        
  26.        
  27.  
  28. site = Employee()
  29.  
  30. site.addEmployee(1001, "Ashish", "01/04/2009", "R$D", "Engineer", 20000, 8000, 20000, 3000)
  31. site.addEmployee(1002, "Sushma", "23/08/2012", "PM", "Consultant", 30000, 12000, 32000, 9000)
  32. site.addEmployee(1003, "Rahul", "12/11/2008", "Acct", "Clerk", 10000, 8000, 12000, 1000)
  33. site.addEmployee(1004, "Chahat", "29/01/2013", "Front Desk", "Receptionist", 12000, 6000, 15000, 2000)
  34. site.addEmployee(1005, "Ranjan", "16/01/2013", "Engg", "Manager", 50000, 20000, 40000, 20000)
  35. site.addEmployee(1006, "Suman", "1/1/2000", "Manyfacturing", "Engineer", 23000, 9000, 20000, 4400)
  36. site.addEmployee(1007, "Tanmay", "12/06/2006", "PM", "Consultant", 29000, 12000, 32000, 10000)
  37.  
  38.          
  39.  
  40. # emp1 = Employee (1001, "Ashish", "01/04/2009", "R$D", "Engineer", 20000, 8000, 20000, 3000)
  41. # emp2 = Employee (1002, "Sushma", "23/08/2012", "PM", "Consultant", 30000, 12000, 32000, 9000)
  42. # emp3 = Employee (1003, "Rahul", "12/11/2008", "Acct", "Clerk", 10000, 8000, 12000, 1000)
  43. # emp4 = Employee (1004, "Chahat", "29/01/2013", "Front Desk", "Receptionist", 12000, 6000, 15000, 2000)
  44. # emp5 = Employee (1005, "Ranjan", "16/01/2013", "Engg", "Manager", 50000, 20000, 40000, 20000)
  45. # emp6 = Employee (1006, "Suman", "1/1/2000", "Manyfacturing", "Engineer", 23000, 9000, 20000, 4400)
  46. # emp7 = Employee (1007, "Tanmay", "12/06/2006", "PM", "Consultant", 29000, 12000, 32000, 10000)
  47.  
  48.          
  49.  
  50. print('----------------------------------------------\n')
  51. print('      Welcome to the Employee Management system    -\n')
  52. print('----------------------------------------------\n')
  53.  
  54. print("Employee Salary Slip: \n")
  55. inp = input('Enter Employee ID: ')
  56. site.displayEmp(inp)