1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tasya [4]
3 years ago
9

Write a program that unpickle's employee dictionary and while reading from the dictionary, it allows users to lookup an employee

in the dictionary, add/update/delete an employee, or quit the program. You must have the following in place: Your program must be in the root directory that you store "Employee.py" file; this way you can import the Employee as a module (hint: import Employee). You must also import "pickle" and "random" modules. For using the methods in Employee object you should call it by Employee.Method_Name()
Computers and Technology
1 answer:
melamori03 [73]3 years ago
7 0

Answer:

Check the explanation

Explanation:

from Employee import *

import pickle

import random

def unpickle_employee(filename):

file=open(filename,'rb')

data=pickle.load(file)

file.close()

return data

def pickle_employee(data,filename):

file=open(filename,'wb')

pickle.dump(data,file)

file.close()

if __name__=='__main__':

filename="Employees.dat"

'''

E=Employee("Ajay",1,"R&D","Manager")

data={}

data[1]=E

pickle_employee(data,filename)

'''

data=unpickle_employee(filename)

 

while True:

print("\nData In Employee.dat")

for d in data:

print("Employe data: ",data[d].get_name(),"({},{},{})".

format(data[d].get_id_number(),data[d].get_department(),data[d].get_job_title()))

 

print("\n\n\t\tMenu")

print("To add new Employee, Enter a")

print("To update any Employee, Enter u")

print("To delete any Employee, Enter d")

print("Enter anything to quit")

choice=input("Enter: ")

if choice=='a':

id_number=random.randrange(100,200,1)

while id_number in data:

id_number+=1

if id_number>=200:

id_number=100

name=input("Enter the Name: ")

department=input("Enter the Department: ")

job_title=input("Enter the job title: ")

E=Employee(name,id_number,department,job_title)

data[id_number]=E

elif choice=='u':

id_number=int(input("Enter the Employee id_number to update: "))

for d in data:

print(id_number,d,d==id_number)

if id_number in data:

print("Employe data: ",data[id_number].get_name(),"({},{})".

format(data[id_number].get_department(),data[id_number].get_job_title()))

print("\nPlease Enter the details")

name=input("Enter the Name: ")

department=input("Enter the Department: ")

job_title=input("Enter the job title: ")

E=Employee(name,id_number,department,job_title)

data[id_number]=E    

else:

print("Employee doesn't exist\n")

elif choice=='d':

id_number=int(input("Enter the Employee id_number to delete: "))

if id_number in data:

print("Employe data: ",data[id_number].get_name(),"({},{})".

format(data[id_number].get_department(),data[id_number].get_job_title()))

choice=input("\nPlease Enter y to confirm, anything else to cancel: ")

if choice=='y':

del data[id_number]

else:

print("Employee doesn't exist\n")

else:

break

pickle_employee(data,filename)

You might be interested in
A(n) _____ describes your core values and highest career goals. A. résumé B. objective statement C. qualifications profile D. pe
Juli2301 [7.4K]

Answer: D.) Personal Mission Statement

Explanation: The personal mission statement refers to a write up which is usually written by an individual and it's tailored to embody one's complete definition in terms of core values, skills, attributes and most importantly present and future desires, goals and objectives. The statement of purpose is usually detailed and will showcase where an individual is currently placed while also showcasing how he or she intends to achieve future aspiration.

8 0
3 years ago
Read 2 more answers
If you Buy my group clothing in R.o.b.l.o.x for a donation i will make you brainliest
erastova [34]

Answer:kk ima do it

Explanation:

7 0
3 years ago
Read 2 more answers
This isn't about school but every time it tells me to watch an ad to unlock the answer to a question it prompts a survey and it
Masja [62]
Restart it than see what happens
4 0
3 years ago
Read 2 more answers
An organization using Robotic Process Automation (RPA) wishes to verify the quality and results of their automated processes to
damaskus [11]

Answer:

Control Center

Explanation:

The element of RPA (Robotic Process Automation) an organization should use to manage and track their automated processes is known as CONTROL CENTER.

Robotic Process Automation has various elements including:

1. Recorder

2. Development Studio

3. Plugin/Extension

4. Bot Runner

5. Control Center

Among these elements are however is the CONTROL CENTER which is considered the most significant element and functions as source control.

It enables the users to plan, manage, control, and measure the movement of a huge amount of digital actions.

4 0
2 years ago
Visual Design includes 4 elements: shapes, texture, lines and form.
Alexxx [7]

Answer:

Explanation:

The answer is false

Because the 4 elements are shapes texture colour and size

6 0
3 years ago
Other questions:
  • Which cloud computing service model gives software developers access to multiple operating systems for testing?
    5·1 answer
  • Which type of statement is used to communicate one’s feelings in a nonconfrontational manner?
    14·1 answer
  • Parameter variables should not be changed within the body of a method because _______________. Select one: a. it mixes the conce
    5·1 answer
  • A ________ -tier design includes a middle layer between the client and server that processes the client requests and translates
    11·1 answer
  • Shortcuts will help you complete spreadsheet tasks more efficiently.
    12·1 answer
  • Andre is teaching a class without the software development cycle while teaching the analyst phase which task should Andre mentio
    8·1 answer
  • Who began digitizing books on a massive scale and putting them online?
    8·1 answer
  • Alex’s family members live in different parts of the world. They would like to discuss the wedding plans of one of their distant
    7·2 answers
  • Given a scanner reference variable named input that has been associated with an input source consisting of a sequence of strings
    14·2 answers
  • Transitive spread refers to the effect of the original things transmitted to the associate things through the material, energy o
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!