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: Pokemon: Pikachu Туре: Electric Weakness: Ground I am a Pokemon. I am Pikachu. 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.") ===== Pokemon: Charmander Туре: Fire Weakness: Water, Ground and Rock I am a Pokemon. I am Charmander. 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() ==")

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

Solve using Python3 and Inheritance method

Task – 9
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:
Pokemon: Pikachu
Туре: Electric
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.")
Weakness: Ground
I am a Pokemon.
I am Pikachu.
Pokemon: Charmander
Туре: Fire
Weakness: Water, Ground and Rock
I am a Pokemon.
I am Charmander.
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()
=")
Transcribed Image Text:Task – 9 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: Pokemon: Pikachu Туре: Electric 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.") Weakness: Ground I am a Pokemon. I am Pikachu. Pokemon: Charmander Туре: Fire Weakness: Water, Ground and Rock I am a Pokemon. I am Charmander. 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() =")
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
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,