Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

Oregon State University Create Private Data with My Code Python Task

Oregon State University Create Private Data with My Code Python Task

Question Description

Code is provided. Please look over to see how we can add private attributes

Currently receiving an error message for being public.

Write a class named Employee that has private data members for an employee’s name, ID_number, salary, and email_address.It should 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 like this:

emp_names = ["Jean", "Kat", "Pomona"]emp_ids = ["100", "101", "102"]emp_sals = [30, 35, 28]emp_emails = ["Jean@aol.com", "Kat@aol.com", "Pomona@aol.com"]result = make_employee_dict(emp_names, emp_ids, emp_sals, emp_emails)print(result["100"].get_name())

Remember in your testing that printing an object of a user-defined class will just print out the object’s type and address in memory. If you want to print the values of its data members, you need to call its get functions, as shown in the print statement above.

The file must be named: make_employee_dict.py

my code:

class Employee:
def __init__(self, emp_names, emp_ids, emp_sals, emp_emails):
self.emp_names = emp_names
self.emp_ids = emp_ids
self.emp_sals = emp_sals
self.emp_emails = emp_emails

def get_name(self):
return self.emp_names

def get_ID_number(self):
return self.emp_ids

def get_salary(self):
return self.emp_sals

def get_email_address(self):
return self.emp_emails


def make_employee_dict(emp_names, emp_ids, emp_sals, emp_emails):
result = {}
for i in range(len(emp_names)):
employees = Employee(emp_names[i], emp_ids[i], emp_sals[i], emp_emails[i])
result[emp_ids[i]] = employees
return result

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: School Assignment only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by School Assignment are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. School Assignment is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At School Assignment, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.