Question: Write an Employee class in Python that keeps data attributes for the following pieces of information: Employee name Employee number Next, write a class named

Write an Employee class in Python that keeps data attributes for the following pieces of information:

Employee name

Employee number

Next, write a class named ProductionWorker in python that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information:

Shift number (an integer, such as 1,2, or 3)

Hourly pay rate

Hours worked

The workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor(getter) and mutator(setter) methods for each class.

Write the program to open a file with employee data.

Use the following data comma delimited file for the employee data file (employees.csv) :

1,Fred Flintstone,1,25,8

2,Barney Rubble,2,26,8

3,George Jetson,3,24,10

4,Jane Jetson,2,25,10

5,Rosie,1,0,24

The employee.csv file is in the format:

employee number,employee name,shift,pay rate,hours worked

Use the csv reader module. The csv reader is a module that was not discussed in the text. The csv module provides a method for opening and easily reading csv(comma separated value) files. Here is an example:

import csv

csvfile =open(employees.csv, newline='') reader = csv.reader(csvfile, delimiter=',') for row in reader: print('number {0} Name: {1}'.format(row[0],row[1]))

The row from the reader object will be a list which has the separate data items.

Write a ShiftManager class in python that will store a dictionary of ProductionWorker objects. The Shiftmanager class should have a member function(method) called add_employee that will add the object to an internal dictionary of ProductionWorker objects. Write another function called print_report (in the Shiftmanager class) which will print out a report of the ProductionWorker information. Make sure that you use the ProductionWorker objects accessor methods to retrieve and display its information on the screen.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!