Question: Here is my current code. I need the following added to it Now you will continue to employ the list data structure and utilize functions

Here is my current code. I need the following added to it

Now you will continue to employ the list data structure and utilize functions to add the following two new functions:

  • Search employee by SSN: This functionality makes use of looping and string parsing to search all the employees in the list and returns the information of the employee who has a SSN similar to the one that the user provided. Your system should display the employee information in the following format:

---------------------------- Mike Smith -----------------------------

SSN: 123123123

Phone: 111-222-3333

Email: mike@test.com

Salary: $6000

------------------------------------------------------------------------

  • Edit employee information: This functionality makes use of the Search employee by SSN function first to find the right employee, then it will allow the user to edit the information of the selected user

CURRENT CODE:

employee_count = 0 #global variable

teammembers = [] # array that holds all individual team members [LIST]

def profile(name, ssn, phone, email, salary): #only prints my data

print(" Employee Profile")

print("---------------------------- " , name , " -----------------------------")

print("SSN: ",ssn)

print("Phone: ",phone)

print("Email: ",email)

print("Salary: $",salary)

print("----------------------------------------------------------------------------")

return None

repeatProgram = "Y"

while (repeatProgram == "Y"):

employee_count = len(teammembers)

print(" There are currently (",employee_count,") team members listed in the system.")

print (" HR Selection options A. List All Team Members B. Select Number For Team Member to Print C. Add New Team Member D. Print Count of Team Members E. Search Team Member SSN")

HR_selection = str(input("Please select an option A/B/C/D/E ?: "))

if (HR_selection == "A"):

if (employee_count == 0):

print ("There are currently 0 team members in the system. Please create a team member by selecting option 'C'.")

else:

print(*teammembers, sep = " ")

elif (HR_selection == "B"):

if(employee_count == 0):

print ("There are currently 0 team members in the system. Please create a team member by selecting option 'C'.")

else:

number = int(input("Enter a user number to display that employee\'s information. User Number: "))

if (number >0 and number<= employee_count):

print(teammembers[number-1])

else:

print("Error Please Select a Valid Integer from the List")

elif (HR_selection == "C"):

for i in range(int(input("How many new employees will you upload to the system? "))):

questions = (" Enter employeeName: ", "Enter employeeSSN: ", "Entry employeeAreaCode Like (XXX)XXX-XXXX: ", "Enter employeeEmail: ", "Enter employeeSalary: $" )

data = [input(ask) for ask in questions]

profile(*data) #defination basically prints data I typed in

teammembers.append(data)

elif (HR_selection == "D"):

print (" There are currently (",employee_count,") team members listed in the system.")

else:

repeatProgram = input("Return to Menu? (Y/N)")

print ("Goodbye!")

I would like to use selection (E) for entering the SSN and then editing that users info. Please advise?

Thank you,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!