Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job title. Don't include a constructor or any other methods. Once you have written the class, write a program that creates three Employee objects to hold the following data: Name ID Number Department Job Title Susan Meyers 47899 Accounting Vice President Mark Jones 39119 IT Programmer Joy Rogers 81774 Manufacturing Engineering The program should store this data in three Employee objects and then print the data for each employee.

Respuesta :

Answer:

Check the explanation

Explanation:

#Define the class Employee.

class Employee:

   #Declare and initialize the required member variables.

   emp_name = ''

   Id_num = ''

   emp_dept = ''

   emp_job_title = ''

#Create an object of the class Employee.

emp_obj1 = Employee()

#Assign required values to the members of the class for a

#particular object.

emp_obj1.emp_name = 'Susan Meyers'

emp_obj1.Id_num = '47899'

emp_obj1.emp_dept = 'Accounting'

emp_obj1.emp_job_title = 'Vice President'

#Create another object of the class Employee.

emp_obj2 = Employee()

#Assign required values to the members of the class for the

#current object.

emp_obj2.emp_name = 'Marke Jones'

emp_obj2.Id_num = '39119'

emp_obj2.emp_dept = 'IT'

emp_obj2.emp_job_title = 'programming'

#Create another object of the class Employee.

emp_obj3 = Employee()

#Assign required values to the members of the class for the

#current object.

emp_obj3.emp_name = 'Joy Rogers'

emp_obj3.Id_num = '81774'

emp_obj3.emp_dept = 'Manufacturing'

emp_obj3.emp_job_title = 'Engineering'

#Display the details of each employee objects.

print('Employee 1 details:')

print('Employee Name:', emp_obj1.emp_name)

print('Employee ID Number:', emp_obj1.Id_num)

print('Employee Department:', emp_obj1.emp_dept)

print('Employee Job Title:', emp_obj1.emp_job_title)

print()

print('Employee 2 details:')

print('Employee Name:', emp_obj2.emp_name)

print('Employee ID Number:', emp_obj2.Id_num)

print('Employee Department:', emp_obj2.emp_dept)

print('Employee Job Title:', emp_obj2.emp_job_title)

print()

print('Employee 3 details:')

print('Employee Name:', emp_obj3.emp_name)

print('Employee ID Number:', emp_obj3.Id_num)

print('Employee Department:', emp_obj3.emp_dept)

print('Employee Job Title:', emp_obj3.emp_job_title)

Kindly check the attached image below for the code output.

Ver imagen temmydbrain

Answer:

The previous andwers needed a few tweaks to be correct.

Explanation:

class Employee:

  #Declare and initialize the required member variables.

  emp_name = ''

  Id_num = ''

  emp_dept = ''

  emp_job_title = ''

#Create an object of the class Employee.

emp_obj1 = Employee()

#Assign required values to the members of the class for a

#particular object.

emp_obj1.emp_name = 'Susan Meyers'

emp_obj1.Id_num = '47899'

emp_obj1.emp_dept = 'Accounting'

emp_obj1.emp_job_title = 'Vice President'

#Create another object of the class Employee.

emp_obj2 = Employee()

#Assign required values to the members of the class for the

#current object.

emp_obj2.emp_name = 'Mark Jones'

emp_obj2.Id_num = '39119'

emp_obj2.emp_dept = 'IT'

emp_obj2.emp_job_title = 'Programmer'

#Create another object of the class Employee.

emp_obj3 = Employee()

#Assign required values to the members of the class for the

#current object.

emp_obj3.emp_name = 'Joy Rogers'

emp_obj3.Id_num = '81774'

emp_obj3.emp_dept = 'Manufacturing'

emp_obj3.emp_job_title = 'Engineer'

#Display the details of each employee objects.

print('Name:', emp_obj1.emp_name)

print('ID Number:', emp_obj1.Id_num)

print('Department:', emp_obj1.emp_dept)

print('Job Title:', emp_obj1.emp_job_title)

print()

print('Name:', emp_obj2.emp_name)

print('ID Number:', emp_obj2.Id_num)

print('Department:', emp_obj2.emp_dept)

print('Job Title:', emp_obj2.emp_job_title)

print()

print('Name:', emp_obj3.emp_name)

print('ID Number:', emp_obj3.Id_num)

print('Department:', emp_obj3.emp_dept)

print('Job Title:', emp_obj3.emp_job_title)