Define a Mammal
class that takes in a habitat parameter when initialized.
A Mammal
has the following instance variables: - hasHair (default true) - liveBirth (default true) - warmBlooded (default true) - habitat (set to the habitat parameter upon initialization)
Define an instance method for a Mammal
that will assess whether or not this mammal is a typicalMammal
. Return a boolean of true if hasHair
, liveBirth
, and warmBlooded
are all true, false if not.
Define a Platypus
class that inherits from the Mammal
class.
A Platypus
should by default be false for liveBirth
because they lay eggs. :O pikachu face
Define an instance method for a Platypus
that will print to the console, "Platypus attacked with venomous claws!"
.
Define an instance method giveBirth
for a Platypus
that will print to the console, "Platypus laid an egg!"
and returns a new instance of the Platypus
class.