write a python code complete questions 3 and 4 from the photo using the following code:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

write a python code

complete questions 3 and 4 from the photo using the following code:


class Employee:
    name = ""
    date_of_birth = "" #string format dd/mm/yyyy
    starting_date = ""
    ssn = 0
    
    #Constructor
    def __init__(self, name, date_of_birth, starting_date, ssn):
        self.name = name
        self.date_of_birth = date_of_birth
        self.starting_date = starting_date
        self.ssn = ssn
    
    #Getter methods
    def getName(self):
        return self.name
    def getDOB(self):
        return self.date_of_birth
    def getStartingDate(self):
        return self.starting_date
    def getSSN(self):
        return self.ssn
        
    #Setter methods
    def setName(self, name):
        self.name = name
    def setDOB(self, date_of_birth):
        self.date_of_birth = date_of_birth
    def setStartingDate(self, starting_date):
        self.starting_date = starting_date
    def setSSN(self):
        self.ssn = ssn
    
    def print(self):
        print("Name: ", self.name)
        print("DOB: ", self.date_of_birth)
        print("Starting date: ", self.starting_date)
        print("SSN: ", self.ssn)

class Hourly_Based_Employee(Employee):
    #Rest data members are dervied from the super class.
    phone_number = 0
    per_Hour = 0
    hours = 0
    
    #Constructor
    def __init__(self, name, date_of_birth, starting_date, ssn, phone_number, per_Hour, hours):
        super().__init__(name, date_of_birth, starting_date, ssn)
        self.phone_number = phone_number
        self.per_Hour = per_Hour
        self.hours = hours
    
    #Getter methods
    def getPhoneNumber(self):
        return self.phone_number
    def getPerHour(self):
        return self.per_Hour
    def getHours(self):
        return self.hours
    
    #Setter methods
    def setPhoneNumber(self, phone_number):
        self.phone_number = phone_number
    def setPerHour(self, per_Hour):
        self.per_Hour = per_Hour
    def setHours(self, hours):
        self.hours = hours
        
    def computeSalary(self):
        return hours*per_Hour

**Creating Subclasses in Object-Oriented Programming**

**3. Create the Subclass `Salary_Based_Employee`**

The `Salary_Based_Employee` subclass is derived from the superclass `Employee`. This subclass includes the following instance variables, constructor, and methods:

- **Instance Variables:**
  a) `name`
  b) `date_of_birth`
  c) `starting_date`
  d) `ssn` (Social Security Number)
  e) `phone_number`
  f) `salary`

- **Methods:**
  g) **Constructor**: Initializes the instance variables.
  h) **Set/Get Methods**: For updating and retrieving the values of the instance variables.
  i) **computeSalary**: Calculates salary based on the employee's salary.
  j) **Print Method**: For displaying the employee's information.

**4. Create the Subclass `Manager_Employee`**

The `Manager_Employee` subclass is derived from the class `Salary_Based_Employee`. This subclass includes the following instance variables, constructor, and methods:

- **Instance Variables:**
  a) `name`
  b) `date_of_birth`
  c) `starting_date`
  d) `ssn`
  e) `phone_number`
  f) `salary`
  g) `bonus`

- **Methods:**
  h) **Constructor**: Initializes the instance variables, including bonus.
  i) **Set/Get Methods**: For modifying and accessing values of the instance variables.
  j) **computeSalary**: Calculates salary based on the employee's salary and bonus.
  k) **Print Method**: For outputting the manager's details.

This exercise illustrates the principles of inheritance in object-oriented programming, showing how subclasses can extend and customize the functionality of their superclasses.
Transcribed Image Text:**Creating Subclasses in Object-Oriented Programming** **3. Create the Subclass `Salary_Based_Employee`** The `Salary_Based_Employee` subclass is derived from the superclass `Employee`. This subclass includes the following instance variables, constructor, and methods: - **Instance Variables:** a) `name` b) `date_of_birth` c) `starting_date` d) `ssn` (Social Security Number) e) `phone_number` f) `salary` - **Methods:** g) **Constructor**: Initializes the instance variables. h) **Set/Get Methods**: For updating and retrieving the values of the instance variables. i) **computeSalary**: Calculates salary based on the employee's salary. j) **Print Method**: For displaying the employee's information. **4. Create the Subclass `Manager_Employee`** The `Manager_Employee` subclass is derived from the class `Salary_Based_Employee`. This subclass includes the following instance variables, constructor, and methods: - **Instance Variables:** a) `name` b) `date_of_birth` c) `starting_date` d) `ssn` e) `phone_number` f) `salary` g) `bonus` - **Methods:** h) **Constructor**: Initializes the instance variables, including bonus. i) **Set/Get Methods**: For modifying and accessing values of the instance variables. j) **computeSalary**: Calculates salary based on the employee's salary and bonus. k) **Print Method**: For outputting the manager's details. This exercise illustrates the principles of inheritance in object-oriented programming, showing how subclasses can extend and customize the functionality of their superclasses.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Constants and Variables
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education