Implement the design of the Pikachu and Charmander classes that are derived from the Pokemon class so that the following output is produced: Driver Code Output class Pokemon: def __init__(self, p): self.pokemon = p self.pokemon_type = "Needs to be set" self.pokemon_weakness = "Needs to be set" def kind(self): return self.pokemon_type def weakness(self): return self.pokemon_weakness def what_am_i(self): print("I am a Pokemon.") pk1 = Pikachu() print("Pokemon:", pk1.pokemon) print("Type:", pk1.kind()) print("Weakness:", pk1.weakness()) pk1.what_am_i() print("========================") c1 = Charmander() print("Pokemon:", c1.pokemon) print("Type:", c1.kind()) print("Weakness:", c1.weakness()) c1.what_am_i() Pokemon: Pikachu Type: Electric Weakness: Ground I am a Pokemon. I am Pikachu. ======================== Pokemon: Charmander Type: Fire Weakness: Water, Ground and Rock I am a Pokemon. I am Charmander.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Implement the design of the Pikachu and Charmander classes that are derived from the Pokemon class so that the following output is produced: Driver Code Output class Pokemon: def __init__(self, p): self.pokemon = p self.pokemon_type = "Needs to be set" self.pokemon_weakness = "Needs to be set" def kind(self): return self.pokemon_type def weakness(self): return self.pokemon_weakness def what_am_i(self): print("I am a Pokemon.") pk1 = Pikachu() print("Pokemon:", pk1.pokemon) print("Type:", pk1.kind()) print("Weakness:", pk1.weakness()) pk1.what_am_i() print("========================") c1 = Charmander() print("Pokemon:", c1.pokemon) print("Type:", c1.kind()) print("Weakness:", c1.weakness()) c1.what_am_i() Pokemon: Pikachu Type: Electric Weakness: Ground I am a Pokemon. I am Pikachu. ======================== Pokemon: Charmander Type: Fire Weakness: Water, Ground and Rock I am a Pokemon. I am Charmander.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Developing computer interface
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
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage