Question
For this interactive assignment, you will apply all the concepts you learned in previous weeks and apply the use of sequential input and output operations
For this interactive assignment, you will apply all the concepts you learned in previous weeks and apply the use of sequential input and output operations to add two new functionalities to your Employee Management System.
- 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.
Here is the program from last week that was used.
employees = []
count = 0
def Add_Employee():
global count
Employee=[]
count+=1
print('Enter name of employee:',end='')
Employee.append(input())
print('Enter employee SSN:',end='')
Employee.append(input())
print('Enter employee phone number:',end='')
Employee.append(input())
print('Enter employee email:',end='')
Employee.append(input())
print('Enter employee salary:',end='')
Employee.append(input())
employees.append(Employee)
def view_all_Employees():
for i in employees:
print("---------------------------- "+i[0]+" -----------------------------")
print('SSN:',i[1])
print('Phone:',i[2])
print('Email:',i[3])
print('Salary:',i[4])
print("------------------------------------------------------------------------")
def search_Employee(ssn):
findIdex=0
for i in employees:
if(i[1]==ssn):
return findIdex
findIdex+=1
return -1
while(True):
print('Enter -1 to exit')
print('Enter 1 to add employee')
print('Enter 2 to view all employees')
print("Enter 3 to update employee information")
print("Enter 4 to search employee with SSN")
a=int(input())
if(a==-1):
break
elif(a==1):
Add_Employee()
print()
elif(a==2):
view_all_Employees()
print()
elif(a==3):
ssn=input("Enter the SSN number to update employee: ")
empIndex=search_Employee(ssn)
empIndex=search_Employee(ssn)
if(empIndex>=0):
employees[empIndex][0]=input("Ente updated name: ")
employees[empIndex][2]=input("Enter updated phone number: ")
employees[empIndex][3]=input("Enter updated email address: ")
employees[empIndex][4]=input("Enter updated salary: ")
print("Employee information has been updated successfully. ")
else:
print("Employee with "+ssn+" is not found. ")
elif(a==4):
ssn=input("Enter the SSN number to find employee: ")
empIndex=search_Employee(ssn)
empIndex=search_Employee(ssn)
if(empIndex>=0):
print("---------------------------- "+employees[empIndex][0]+" -----------------------------")
print('SSN:',employees[empIndex][1])
print('Phone:',employees[empIndex][2])
print('Email:',employees[empIndex][3])
print('Salary:',employees[empIndex][4])
print("------------------------------------------------------------------------ ")
else:
print("Employee with "+ssn+" is not found. ")
else:
print('invalid output')
Once you have completed the functionalities, provide the following in your initial post:
- One screen shot of each completed functionality.
- 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.
- The attached zip folder that contains the running source code. Your instructor will run your source code to ensure that the functionality runs correctly.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started