question archive For this assignment, continue to use variables, functions, and control structures to improve the "View all Employees" functionality developed in Week 3 and utilize functions and the passing of parameters to add two new functionalities to the Employee Management System
Subject:Computer SciencePrice:6.89 Bought3
For this assignment, continue to use variables, functions, and control structures to improve the "View all Employees" functionality developed in Week 3 and utilize functions and the passing of parameters to add two new functionalities to the Employee Management System.
Update the "View all Employees" functionality developed in Week 3 to view the result in the following format:
---------------------------- Mike Smith -----------------------------
SSN: 123123123
Phone: 111-222-3333
Email:
Salary: $6000
------------------------------------------------------------------------
---------------------------- Sara Smith -----------------------------
SSN: 123123111
Phone: 111-222-4444
Email:
Salary: $6500
------------------------------------------------------------------------
Now continue to employ the list data structure and utilize functions to add the following two new functions:
---------------------------- Mike Smith -----------------------------
SSN: 123123123
Phone: 111-222-3333
Email:
Salary: $6000
------------------------------------------------------------------------
Once completed Functionality 4, provide the following in a Word document.
My Functionality 3 was:
# function to add employee (functionality 1)
def addEmployee():
employeeName = input("nEnter Employee Name: ")
employeePhone = input("Enter Employee Phone Number: ")
employeeSSN = input("Enter Employee SSN: ")
employeeEmail = input("Enter Employee Email: ")
employeeSalary = input("Enter Employee Salary: ")
employeeInfo = []
employeeInfo.append(employeeName)
employeeInfo.append(employeePhone)
employeeInfo.append(employeeSSN)
employeeInfo.append(employeeEmail)
employeeInfo.append(employeeSalary)
return employeeInfo
# function to view all employees (functionality 2)
def viewAllEmployee(employees):
if len(employees) == 0:
print("nThere is no employeesn")
else:
print("n")
for employee in employees:
print("nEmployee "+str(employees.index(employee)+1)+" details:")
print("tEmployee_Name:",employee[0])
print("tPhone:",employee[1])
print("tSSN:",employee[2])
print("tEmail:",employee[3])
print("tSalary:",employee[4])
print("n")
# Main (functionality 3)
employees = []
employeeCount = 0
while True:
print("1. Add Employeen2. View all Employeesn3. Exit")
choice = int(input("nEnter a choice (1/2/3): "))
if choice == 1:
info = addEmployee()
employees.append(info)
employeeCount += 1
print("n"+str(employeeCount)+" employee's information is addedn")
elif choice == 2:
viewAllEmployee(employees)
elif choice == 3:
break
else:
print("nInvalid choice. Please Try again...n")
Purchased 3 times