Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python, write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job title. Don't

In Python, 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

Marke Jones, 39119, IT, programming

Joy Rogers, 81774, Manufacturing, Engineering

The program should store its data in three employee objects and then print the data for each employee.

Im having trouble with formatting because I want my code to be displayed as so

image text in transcribed

The coding I have so far

class Employee: def __init__(self, Name, id_Number, Department, Job_Title): self.__Name = Name self.__id_Number = id_Number self.__Department = Department self.__Job_Title = Job_Title def set_Name(self, Name): self.__Name = Name return self.__Name def set_id_Number(self, id_Number): self.__id_Number = id_Number return self.__id_Number def set_Department(self, Department): self.__Department = Department return self.__Department def set_Job_Title(self, Job_Title): self.__Job_Title = Job_Title return self.__Job_Title def __str__(self): return self.__Name + '{:>10}'.format('ID Number: ') + self.__id_Number + '{:>10}'.format( 'Department: ') + self.__Department + '{:>10}'.format('Job Title: ') + self.__Job_Title def main(Employee): employee1 = Employee('Name', 'id_Number', 'Department', 'Job_Title') employee2 = Employee('Name', 'id_Number', 'Department', 'Job_Title') employee3 = Employee('Name', 'id_Number', 'Department', 'Job_Title') employee1.set_Name('Susan Meyers') employee1.set_id_Number('47899') employee1.set_Department('Accounting') employee1.set_Job_Title('Vice President') employee2.set_Name('Mark Jones') employee2.set_id_Number('39119') employee2.set_Department('IT') employee2.set_Job_Title('Programmer') employee3.set_Name('Joy Rogers') employee3.set_id_Number('81774') employee3.set_Department('Manufacturing') employee3.set_Job_Title('Engineer') print(employee1) print(employee2) print(employee3) main(Employee)
Name Susan Meyers ID Number 47899 Department Accounting Job Title Vice President Name Susan Meyers ID Number 47899 Department Accounting Job Title Vice President

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David Kroenke

11th Edition

0132302675, 9780132302678

More Books

Students also viewed these Databases questions