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
svp [43]
3 years ago
7

Write a class named Employee that has private data members for an employee's name, ID_number, salary, and email_address. It shou

ld have an init method that takes four values and uses them to initialize the data members. It should have get methods named get_name, get_ID_number, get_salary, and get_email_address. Write a separate function (not part of the Employee class) named make_employee_dict that takes as parameters a list of names, a list of ID numbers, a list of salaries and a list of email addresses (which are all the same length). The function should take the first value of each list and use them to create an Employee object. It should do the same with the second value of each list, etc. to the end of the lists. As it creates these objects, it should add them to a dictionary, where the key is the ID number and the value for that key is the whole Employee object. The function should return the resulting dictionary. For example, it could be used l
Computers and Technology
1 answer:
mario62 [17]3 years ago
6 0

Solution :

class Employee:

   #Define the

   #constructor.

   def __$\text{init}$__($\text{self, nam}e$,  ID_number, $\text{salary}$, email):

       #Set the values of

       #the data members of the class.

       $\text{self.nam}e$ = name

       $\text{self.ID}$_number = ID_number

       $\text{self.salary}$ = salary

       self.email_address = email

#Define the function

#make_employee_dict().

def make_employee_dict(list_names, list_ID, list_salary, list_email):

   #Define the dictionary

   #to store the results.

   employee_dict = {}

   #Store the length

   #of the list.

   list_len = len(list_ID)

   #Run the loop to

   #traverse the list.

   for i in range(list_len):

       #Access the lists to

       #get the required details.

       name = list_names[i]

       id_num = list_ID[i]

       salary = list_salary[i]

       email = list_email[i]

       #Define the employee

       #object and store

       #it in the dictionary.

       employee_dict[id_num] = Employee(name, id_num, salary, email)

   #Return the

   #resultant dictionary.

   return employee_dict

You might be interested in
What scientific principle would a plumber need to know when designing and installing plumbing a new construction
Volgvan
Diong reasearch to know what your dion
7 0
4 years ago
A student builds a model of her bedroom. The scale is 1:25. In the scale model, the students bed is 3 inches long. How long is t
Fittoniya [83]

Answer:

The student’s actual bed is 75 inches long

Explanation:

Here in this question, we want to find out the length of the student’s actual bed.

The ratio of the model to the real is 1:25

Let the actual length of the bed be x inches

Thus;

1/25 = 3/x

By cross multiplying

1 * x = 3 * 25

x = 75 inches

5 0
3 years ago
Which security risk is an example of malware?
marshall27 [118]
Viruses, worms, ransomware, spyware and trojan horses. These are some answers 
3 0
4 years ago
Read 2 more answers
Each object that is created from a class is called a(n) ____________ of the class.
gladu [14]
Instance





-------------------------
7 0
3 years ago
Read 2 more answers
Sub to the channel plz plz
Hunter-Best [27]

Answer:

um

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Given the plaintext {0F0E0D0C0B0A09080706050403020100} and the key {02020202020202020202020202020202}: a. Show the original cont
    11·1 answer
  • 1. Mobile devices have a _________ viewport that displays a web page content that fits within a mobile screen.
    11·1 answer
  • Which of these decisions would u most likely make on ur own
    8·2 answers
  • I swear I’m hopeless....
    8·1 answer
  • Of the three types of mutating malware, what type changes its internal code to one of a set number of predefined mutations whene
    9·1 answer
  • Need help . business and technology
    11·1 answer
  • What does it mean when your phone says system ui has stopped?
    7·1 answer
  • The data type of 17.3 should be ________________.
    12·2 answers
  • How was the Big Ben project similar to the investigation you conducted in class to determine if the table was vibrating? How is
    7·1 answer
  • I need help 50 points and brainiest if you answer
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!