Respuesta :
The given below is the code for the given scenario.
What is Inheritance?
Inheritance allows you to define a class that inherits all its methods and properties from another class. The parent class is the class from which it inherits, also called the base class. A child class is a class that inherits from another class, also called a derived class.
Code:
class Professional_Sports_Team:
# Directory class will create an object that stores the team name,
# home city and sport played.
def __init__(self, team_name, home_city, sport):
self.__team_name = team_name
self.__home_city = home_city
self.__sport = sport
# Mutators/Setters
def set_team_name(self, team_name):
self.__team_name = team_name
def set_home_city(self, home_city):
self.__home_city = home_city
def set_sport(self, sport):
self.__sport = sport
# Accessors/Getters
def get_team_name(self):
return self.__team_name
def get_home_city(self):
return self.__home_city
def get_sport(self):
return self.__sport
# MLB Teams subclass should inherit from the Professional Sports Team class MLB_Team(Professional_Sports_Team):
def __init__(self, team_name, home_city, sport, mascot,team_batting_average, team_pitching_ERA):
# call super class constructor
super(MLB_Team, self).__init__(team_name, home_city,sport) self.____mascot = mascot
self.__team_batting_average = team_batting_average self.__team_pitching_ERA = team_pitching_ERA
# This method assigns a string to the __mascot field.
def set_mascot(self, mascot):
self.____mascot = mascot
# This method assigns a value to the __team_batting_average field.
def set_team_batting_average(self, team_batting_average): self.__team_batting_average = team_batting_average
# This method assigns a value to the __team_pitching_ERA field.
def set_team_pitching_ERA(self, set_team_pitching_ERA): self.__team_pitching_ERA = set_team_pitching_ERA
# This method returns the string of the __mascot field.
def get_mascot(self):
return self.____mascot
# This method returns the value from the __team_batting_average field. def get_team_batting_average(self):
return self.__team_batting_average
# This method returns the value from the __team_pitching_ERA field. def get_team_pitching_ERA(self):
return self.__team_pitching_ERA
Class information including team name, hometown and sport played is already available here. It also contains all the setters/getters for those attributes. You should create a subclass based on the classes defined in this module with getters and setters. This activity requires you to upload the modified module file along with the other files.
To learn more about Inheritance and Code, click on the given link: https://brainly.com/question/15078897
#SPJ4