Export employees’ information to text file : This functionality will allow the user to save the employee information saved in the list to the file system. Each list entry should be saved into a new...

1 answer below »



  • Export employees’ information to text file: This functionality will allow the user to save the employee information saved in the list to the file system. Each list entry should be saved into a new line. You may notice by now that closing the script will cost your Employee Management System to lose all entered employees’ information. Exporting the current system data into a file system will help you to save this information permanently on the hard disk and be able to use it at later time.




  • Import employees’ information from text file: This functionality will help you to import preexisting employee information from a text file saved on the file system. Each line in the text should be saved as a new list entry. When you run your Employee Management System for the first time you should be able to populate the system with preexisting employee information, if there are any, instead of adding this information manually to the system.



  • An explanation of how you applied the use of sequential input and output operations to add the two new functionalities to the Employee Management System.

  • A brief description the purpose of this functionality.

  • The script for each functionality.








Answered Same DayMay 26, 2021

Answer To: Export employees’ information to text file : This functionality will allow the user to save the...

Pritam answered on May 30 2021
145 Votes
counter = 0
lstEmployees = []
def addEmployee():
    global counter
    global lstEmployees
    counter += 1

    name = input('\nEnter employee name: ')
    ssn = input('Enter employee SSN: ')
    phone = input('Enter employee phone number: ')
    email = input('Enter employee email: ')
    salary = input('Enter employee salary: $')
    newEmployee = [ssn, name, phone, email, salary]
    lstEmployees.append(newEmployee)
    
def viewAllEmployees():
    global counter
    global lstEmployees
    if counter == 0:
        print("\nThere are currently NO EMPLOYEES to display!")
    for employee in lstEmployees:
        print("\n\t----------------------- " + employee[1] + " -----------------------")
        print("\tSSN: \t" + employee[0])
        print("\tPhone: \t" + employee[2])
        print("\tEmail: \t" + employee[3])
        print("\tSalary:\t$" + employee[4])
        print("\t------------------------" + '-'*len(employee[1]) + "------------------------")
        
def searchBySSN():
    global lstEmployees
    ssn = input('Enter SSN to be searched: ')
    found = 0
    emp = None
    for employee in...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here