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
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
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 1DE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Knowledge Booster
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.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning