def employee_creator(employee_list=[],employee_file_list=[]): #we need to create the list of employees employee=my_employee.Employee() employee_list.append(employee.list_setter()) employee_file_name=employee.file_setter() employee_file_list.append(employee_file_name) return employee_list,employee_file_list
def change(my_data): id_num = input('Enter an ID: ') if id_num in my_data: name = input('Enter your name: ') dept = input('Enter the department: ') title = input('Enter the job title: ') entry = employee_class.Employee(name, id_num, dept, title) my_data[id_num] = entry print('Entry has been updated.') else: print('That ID was not found.')
def add(my_data): id_num = input('Enter an ID Number: ') name = input('Enter your name: ') dept = input('Enter the department: ') title = input('Enter the job title: ') # Create an instance of the employee class named entry entry = employee_class.Employee(name, id_num, dept, title) # If id num not in dictionary, add it as a key with # the entry object as value if id_num not in my_data: my_data[id_num] = entry print('The entry has been added.') else: print('That name already exists.')
def add(details): #get employee's info name = input('Name: ') id_number = input('ID Number: ') department = input('Department: ') title = input('Job Title: ') #create employee object named entry entry = employee_class.Employee(name, id_number, department, title) #If the ID Number does not exist in the dictionary, #add it as key with the entry objects as the value if id_number not in details: details[id_number] = entry print('The entry has been added.') else: print('That ID Number already exists.')
def create_object_list(): #Create an empty list to hold the ojbects employee_list = [] #Enter the particulars of the employees for count in range(3): print('Provide particulars for Employee #',count + 1,sep='') name = input('Enter Name: ') number = input("Enter ID Number: ") department = input('Enter Department: ') title = input('Enter Job Title: ') print() #creating three objects of the class employees = employee_class.Employee(name,number,department,title) #append the objects to the list employee_list.append(employees) #return employee_list return employee_list
def change(details): #get id numbe id_number = input('Enter ID Number: ') #if id number is in dictionary, #provide new details if id_number in details: name = input('Enter the new name: ') department = input('Enter new department: ') title = input('Enter new title: ') #create employee object entry = employee_class.Employee(name, id_number, department, title) #updating the entry details[id_number] = entry print('information updated.') else: print('ID Number not found')