NEEDS TO BE ANSWERED IN PYTHON CODING LANGUAGE!
In this assignment, we will practice inheritance by coding Pokémon. In the Assignment 6 template, we have a
parent Pokémon class and two child classes Pikachu, and Bulbasaur (If you would like to implement a
different Pokémon feel free to do so!). In the game of Pokémon, and TV show, Pokémon battle other
Pokémon, using special powers. The Pokémon parent class and Child classes should have the following
components.
Pokemon:
• Constructor (All pokemon have the following properties):
o Name: Name of the Pokemon
o Level: All Pokemon start at level 1
o Health: Pokemon have 100 health points by default
o Pokemon_type: Pokemon default to "Normal"
• Attack Method:
o Takes a parameter attackee (which is another Pokemon object) and subtracts
health points of the attackee.
• Speak Method:
o Much like the Animal speak method from our previous exercises, the speak
method of the pokemon class is typically some derivation of the Pokemon’s
name.
Pikachu (2.5pts):
• Constructor (Inherits Pokémon Parent Class Constructor)
o Sets name to Pikachu
o Sets type to "Electric"
• Attack Method:
o Overrides the base attack method
o Takes a parameter attackee (which is another Pokemon object), and subtracts
health points of the attackee.
o Instead of attacks, the following should be printed every time this method is run
▪ Pikachu uses thunderbolt on pokemon.name
▪ It did X damage
• Speak Method:
o Overrides the base speak method, and prints "Pika Pika... Pikachu" when called
Bulbasaur (2.5pts):
• Constructor (Inherits Pokemon Parent Class Constructor)
o Sets name to Bulbasaur
o Sets type to "Grass"
• Attack Method:
o Takes in a Pokemon object, and subtracts health points
o Instead of attacks, the following should be printed every time this method is run
▪ Bulbasaur uses razor leaf on pokemon.name
▪ It did X damage
• Speak Method:
o Overrides the base speak method, and prints "Bulba Bulba... Bulbasaur"
These creatures also battle each other in a Pokemon Stadium. The stadium will house the two Pokemon,
and will be the arena in which they battle against each other. The Stadium class will look like the
following:
Stadium (2 pts):
• Constructor ()
o Stadium Name
o Pokemon A
o Pokemon B
• Battle Method:
o Follows the following sequence of events:
o Both Pokemon Speak to each other
o Next, the Pokemon attack each other until one of the Pokemon’s health points is 0
o At each iteration, the health points and attacks of each Pokemon should display
to the user running the program
class Pokemon:
def __init__(self, name, level=1, health=100, pokemon_type="Normal" ):
self.name = name
self.level = level
self.health = health
self.type = pokemon_type
def attack(self, attackee):
print(self.name, "Attacks",attackee.name )
attackee.health = attackee.health - 10
def speak(self):
print("Pokemon sound")
def __str__(self):
return "Pokemon: {}".format(self.name)
class Pikachu(Pokemon):
def __init__(self):
pass
def attack(self, attackee):
pass
def speak(self):
pass
class Bulbasaur(Pokemon):
def __init__(self):
pass
def attack(self, attackee):
pass
def speak(self):
pass
class Stadium():
def __init__(self, name, pokemon_a, pokemon_b):
pass
def battle(self):
pass