Please read all parts of this question before starting the question. Include the completed code for all parts of this question in a file called superheroes.py. NOTE: To implement encapsulation, all of the instance variables/fields should be considered private. Question 2 (a) Whenever folks on Earth get into trouble they look towards the Superheroes Federation to save them. Design and implement a Python class called Hero that includes the following class variable(s), instance variable(s) and method(s) for the class. Class variable(s): •TotalNumHeroes is the total number of heroes listed with the Federation • TotalNumChallengesMet is the total number of challenges that all the federation members have successfully overcome Attribute(s)/instance variable(s): •herolD is the unique ID number for the superhero (default value "N/A") • lifeName is the real-life name of the superhero (e.g. Bruce Wayne) (default value "N/A") • alterEgo is the secondary self or secret identity of the superhero (e.g. Batman) (default value "N/A") • firstAppeared is the year this superhero was introduced first (e.g. 1939) (default value 0) • knownFor is the special feature for which the hero is known (e.g. can lift unusually heavy objects) (default value "N/A") •toolOfstrength is a tool or weapon that is used by the superhero (e.g. hammer) (default value "N/A") •numOfchallengesMet is a number that indicates how many challenges have been faced and overcome by the superhero (default value 0) The class definition should also include the fllowing method(s): •a constructor/initializer method, including default values •accessor methods to access and return the instance variables herolD, alterEgo, and numofchallengesMet •a mutator method to update (i.e., add an amount to) the instance variable numofChallengesMet •the special method_str_() to print the required information, including the herolD, lifeName, alterEgo, firstAppeared, knownFor, toolofstrength and numofchallengesMet with appropriate descriptive labels as shown in the sample output below

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 1DE
icon
Related questions
Question
Please read all parts of this question before starting the question. Include the completed code for all parts of
this question in a file called superheroes.py.
NOTE: To implement encapsulation, all of the instance variables/fields should be considered private.
Question 2 (a)
Whenever folks on Earth get into trouble they look towards the Superheroes Federation to save them.
Design and implement a Python class called Hero that includes the following class variable(s), instance
variable(s) and method(s) for the class.
Class variable(s):
• TotalNumHeroes is the total number of heroes listed with the Federation
• TotalNumChallengesMet is the total number of challenges that all the federation members have
successfully overcome
Attribute(s)/instance variable(s):
• herolD is the unique ID number for the superhero (default value "N/A")
• lifeName is the real-life name of the superhero (e.g. Bruce Wayne) (default value "N/A")
• alterEgo is the secondary self or secret identity of the superhero (e.g. Batman) (default value
"N/A")
• firstAppeared is the year this superhero was introduced first (e.g. 1939) (default value 0)
• knownFor is the special feature for which the hero is known (e.g. can lift unusually heavy objects)
(default value "N/A")
• toolOfstrength is a tool or weapon that is used by the superhero (e.g. hammer) (default value
"N/A")
• numofchallengesMet is a number that indicates how many challenges have been faced and
overcome by the superhero (default value 0)
The class definition should also include the following method(s):
• a constructor/initializer method, including default values
• accessor methods to access and return the instance variables herolD, alterEgo, and
numofchallengesMet
• a mutator method to update (i.e., add an amount to) the instance variable numOfchallengesMet
the special method_str_() to print the required information, including the herolD, lifeName,
alterEgo, firstAppeared, knownFor, toolOfStrength and numofChallengesMet with appropriate
descriptive labels as shown in the sample output below
Transcribed Image Text:Please read all parts of this question before starting the question. Include the completed code for all parts of this question in a file called superheroes.py. NOTE: To implement encapsulation, all of the instance variables/fields should be considered private. Question 2 (a) Whenever folks on Earth get into trouble they look towards the Superheroes Federation to save them. Design and implement a Python class called Hero that includes the following class variable(s), instance variable(s) and method(s) for the class. Class variable(s): • TotalNumHeroes is the total number of heroes listed with the Federation • TotalNumChallengesMet is the total number of challenges that all the federation members have successfully overcome Attribute(s)/instance variable(s): • herolD is the unique ID number for the superhero (default value "N/A") • lifeName is the real-life name of the superhero (e.g. Bruce Wayne) (default value "N/A") • alterEgo is the secondary self or secret identity of the superhero (e.g. Batman) (default value "N/A") • firstAppeared is the year this superhero was introduced first (e.g. 1939) (default value 0) • knownFor is the special feature for which the hero is known (e.g. can lift unusually heavy objects) (default value "N/A") • toolOfstrength is a tool or weapon that is used by the superhero (e.g. hammer) (default value "N/A") • numofchallengesMet is a number that indicates how many challenges have been faced and overcome by the superhero (default value 0) The class definition should also include the following method(s): • a constructor/initializer method, including default values • accessor methods to access and return the instance variables herolD, alterEgo, and numofchallengesMet • a mutator method to update (i.e., add an amount to) the instance variable numOfchallengesMet the special method_str_() to print the required information, including the herolD, lifeName, alterEgo, firstAppeared, knownFor, toolOfStrength and numofChallengesMet with appropriate descriptive labels as shown in the sample output below
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
void method
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning