Given the provided class, please make the following modifications.  class Employee:     def __init__(self, name, number):         self.name = name         self.number = number          class ProductionWorker(Employee):     def __init__(self, name, number, shift_number, employee_number):         Employee.__init__(self, name, number)         self.shift_number = shift_number         self.employee_number = employee_number # Create an instance of the ProductionWorker class and test it employee1 = ProductionWorker("John Doe", 1234, 2, 5678) print(employee1.name)

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 9RQ
icon
Related questions
Question

Given the provided class, please make the following modifications. 

class Employee:
    def __init__(self, name, number):
        self.name = name
        self.number = number
        
class ProductionWorker(Employee):
    def __init__(self, name, number, shift_number, employee_number):
        Employee.__init__(self, name, number)
        self.shift_number = shift_number
        self.employee_number = employee_number

# Create an instance of the ProductionWorker class and test it
employee1 = ProductionWorker("John Doe", 1234, 2, 5678)
print(employee1.name)
print(employee1.number)
print(employee1.shift_number)
print(employee1.employee_number)

Write a class that creates an object of the ProductionWorker class and prompts the user to enter data for each of the object's data attributes. Store the data in the object, then use the object's accessor methods to retrieve it and display it on the screen. 

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning