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
Alexxx [7]
3 years ago
14

Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job

title.
Once you have written the class, write a python program that creates 3 Employee objects to hold the following data:
Name: Susan Meyers, ID number: 47899, Department: Accounting, Job Title: Vice President
Name: Mark Jones, ID Number: 39119, Department: IT, Job Title: Programmer
Name: Jon Rogers, ID Number: 81774, Department: Manufacturing, Job Title: Engineer
The prgram should store this data in the 3 objects and then display the data for each employee on the screen.
Computers and Technology
1 answer:
viktelen [127]3 years ago
4 0

firstly we have to create class and then constructors and method

let start with class

class Employee:

   def __init__(self, name, id, department, title):

       self.__name = name

       self.__id = id

       self.__department = department

       self.__title = title

   def set_name(self, name):

       self.__name = name

   def set_id(self, id):

       self.__id = id

   def set_department(self, department):

       self.__department = department

   def set_title(self, title):

       self.__title = title

   def get_name(self):

       return self.__name

   def get_id(self):

return self.__id

   def get_department(self):

       return self.__department

   def get_title(self):

       return self.__title

def __str__(self):

       return 'Name: ' + self.__name + \

              '\nID number: ' + self.__id + \

              '\nDepartment: ' + self.__department + \

              '\nTitle: ' + self.__title

Now to test the program

import emp

def main():

   emp1 = emp.Employee('name', 'id', 'department', 'title')

   emp2 = emp.Employee('name', 'id', 'department', 'title')

   emp3 = emp.Employee('name', 'id', 'department', 'title')

 

   emp1.set_name('Susan Meyers')

   emp1.set_id('47899')

   emp1.set_department('Accounting')

   emp1.set_title('Vice President')

   emp2.set_name('Mark Jones')

   emp2.set_id('39119')

   emp2.set_department('IT')

   emp2.set_title('Programmer')

   emp3.set_name('Joy Rogersr')

   emp3.set_id('81774')

   emp3.set_department('Manufacturing')

   emp3.set_title('Engineer')

   print()

   print(emp1)

   print()

 print(emp2)

   print()

   print(emp3)

main()

You might be interested in
Algonac Systems, a software start-up company, uses a technology in which the employees have to key in certain names and their re
Masteriza [31]

Answer:

ADD ME ON TIK TOK @ madison.beautiful.dancer

Explanation:

3 0
3 years ago
What command would you use to view the path taken by an ethernet packet in windows?
Anni [7]
Hey there,
The answer is <span>tracert.

Hope this helps :))

~Top
</span>
5 0
3 years ago
What is JavaScript? JavaScript is a _____ language.
disa [49]

Answer: dynamic computer language

Explanation:

JavaScript is a dynamic computer language. Hope this helps! (•‿•)

5 0
3 years ago
Read 2 more answers
Select the correct answer.
liraira [26]
I think is the second one or the first one
5 0
3 years ago
Read 2 more answers
How is primary storage different from secondary storage? Select the TWO correct statements.
Zina [86]
Primary storage refers to the main storage of the computer or main memory which is the random access memory or RAM. Secondary storage, on the other hand, refers to the external storage devices used to store data on a long-term basis.
7 0
3 years ago
Other questions:
  • With ________, website programmers can import data from other sources to create new functions and features that we associate wit
    14·1 answer
  • Someone may choose to own a car instead of leasing because:
    14·2 answers
  • What is a thicknet?
    14·1 answer
  • Someone once observed that "the difference between roles and groups is that a user can shift into and out of roles, whereas that
    13·1 answer
  • Anyone can give me the definition of specification ?
    10·2 answers
  • When working with copper cabling (as opposed to fiber optic) a ________ can check a variety of a cable's electrical characterist
    13·1 answer
  • Linux distributions automatically come with a native software firewall.TrueFalse
    13·1 answer
  • What information is used in a communication between two system
    10·1 answer
  • A Python programmer is writing a function definition. What syntax should be used?
    12·2 answers
  • The rules that govern the correct order and usage of the elements of a language are called the of the language:.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!