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
PLEASE HELP!!!!!! ASAP
NNADVOKAT [17]

Answer:

use a wizard or use a design view

Explanation:

i took the test

4 0
3 years ago
Read 2 more answers
The scene of a human sitting at a computer terminal, responding to stimuli flashed on the computer screen, would most likely be
katrin2010 [14]

I guess the correct answer is information processing

Infοrmatiοn prοcеssing is thе changе (prοcеssing) οf infοrmatiοn in any mannеr dеtеctablе by an οbsеrvеr. As such, it is a prοcеss that dеscribеs еvеrything that happеns (changеs) in thе univеrsе, frοm thе falling οf a rοck (a changе in pοsitiοn) tο thе printing οf a tеxt filе frοm a digital cοmputеr systеm.

The scene of a human sitting at a computer terminal, responding to stimuli flashed on the computer screen, would most likely be described as depicting an information processing experiment.

7 0
2 years ago
HTML coding tells a computer what to do by using a series of?
kkurt [141]

Answer:

Elements

Explanation:

A computer code acts as a medium by which a person can communicate with the computer machine.

One such language is known as HTML or hypertext markup language.  HTML stands for Hypertext markup language which is used to markup the language for web pages in computer.

The HTML series consists of a series of elements which are enclosed in the tags commonly called start tag and a stop tag.

Example <head>  

here,  

the head is a series of elements.

< start-tag

> stop-tag

Thus, element is the correct answer.

5 0
3 years ago
Read the description of Mike’s work, and identify his profession. Mike’s job is to record sounds in a studio. He studies a video
kipiarov [429]
Mike is a Sound Engineer
7 0
2 years ago
Read 2 more answers
Unwanted or unneeded software included by manufacturers on new computers is called
Travka [436]
The answer is called bloatware. This is unneeded files that are actually on the computers which are already there even if it's new. It doesn't have any essential function and sometimes is a trial version. The application also adds up space which limits your free space storage. In other words, because it has no significant tasks to handle it is unnecessary, but it only serves as an additional profit to the company once it is purchased by the buyer.

Bloatware may also come especially in adware where a lot of extension applications are sometimes automatically installed after it is allowed to operate in just a click. The only solution for a bloatware is to uninstall it.  .
5 0
3 years ago
Other questions:
  • 1. Isabella is a security support manager for a large enterprise. In a recent meeting, she was asked which of the standard netwo
    7·1 answer
  • Which osi reference model layer includes all programs on a computer that interact with the network?
    13·1 answer
  • How is a network address of 192.168.6.0 and a subnet mask of 255.255.254.0 written in cidr?
    12·1 answer
  • Sanjay is giving a slideshow presentation on his entire college class and he is feeling quite nervous in order to share his pres
    9·1 answer
  • A key field is used to _____. enter a password uniquely identify records merge data list the most important information
    12·2 answers
  • True or false?
    13·1 answer
  • A program called a ( n ) ____ translates instructions written in high-level languages into machine code.
    13·1 answer
  • Mention the generation we have in computer​
    7·1 answer
  • 100 POINTS NEED THIS BEFORE 11:59 TODAY!!!!!!!!!!!!!!!
    8·1 answer
  • Write a function called no_you_pick. no_you_pick should have two parameters. The first parameter is a dictionary where the keys
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!