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
Most people entering the construction industry learn a specific craft through:
LuckyWell [14K]
Most people entering the construction industry learn a specific craft through: An apprenticeship program
7 0
3 years ago
Read 2 more answers
_________ are the special effects that you see when one slide changes to another in slide show view​
lisabon 2012 [21]

Answer:

Transition effects

Explanation:

Transition effects are the special effects you see when one slide changes to another in slide show view.

8 0
3 years ago
What does a linear bus topology used to connect all network devices?
pentagon [3]
<span>A linear bus topology uses a common background cable to connect all network devices.</span>
5 0
4 years ago
Assume the following variable definition appears in a program:
AnnZ [28]

Answer:

cout << setprecision(2)<< fixed << number;

Explanation:

The above statement returns 12.35 as output

Though, the statement can be split to multiple statements; but the question requires the use of a cout statement.

The statement starts by setting precision to 2 using setprecision(2)

This is immediately followed by the fixed manipulator;

The essence of the fixed manipulator is to ensure that the number returns 2 digits after the decimal point;

Using only setprecision(2) in the cout statement will on return the 2 digits (12) before the decimal point.

The fixed manipulator is then followed by the variable to be printed.

See code snippet below

<em>#include <iostream>  </em>

<em>#include <iomanip> </em>

<em>using namespace std;  </em>

<em>int main()  </em>

<em>{  </em>

<em> // Initializing the double value</em>

<em> double number = 12.3456;  </em>

<em> //Print  result</em>

<em> cout << setprecision(2)<< fixed << number;  </em>

<em> return 0;  </em>

<em>}  </em>

<em />

4 0
3 years ago
What do the 100 or so atoms of the periodic table, in different combinations, make up
Nikolay [14]

Answer:

100 or so atoms of the periodic table, in different combinations, make up <u>Compounds</u>.

Explanation:

Atoms from different element in the periodic table combined together with the help of  bond and make a new product that is called compound.

<u>For example</u>

Hydrogen and oxygen are the elements of the periodic table. When one atom of oxygen and two atoms of hydrogen are combined together, a compound will be formed named as water (H20).

In another example, two atoms of oxygen and one atom of carbon combines toghther through chemical reaction and make compund named as Carbon dioxide (CO2).

6 0
3 years ago
Other questions:
  • How can you keep your files organized on your computer?
    13·2 answers
  • Write a brief one parapragh summary describing the financial reality of the American family.
    10·1 answer
  • The date June 10, 1960, is special because when it is written in the following format, the month times the day equals the year:
    5·1 answer
  • A communications objective is:
    12·1 answer
  • Camille prepared excellent PowerPoint slides for her speech about education reform, but the speech didn't go as well as she had
    15·1 answer
  • Write a calculator program using a switch statement that: a) Prompts the user to enter two numbers b) Prompts the user to select
    6·1 answer
  • You are planning a program to find the maximum heart rate recommended for patrons of a gym where you have a part-time job. One f
    13·1 answer
  • Match each item with a statement below. - A popular port scanners that has the ability to use a GUI front end - Allows you to pi
    8·1 answer
  • Question #5
    11·2 answers
  • Types of computer viruses<br>​
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!