Problem 3: Noisy Cat (100pts)
Problem
More cats! Fill in this implementation of a class called
NoisyCat, which is just like a normalCat. However,NoisyCattalks a lot -- twice as much as a regularCat!We may change the implementation of
PetandCatwhile testing your code, so make sure you use inheritance correctly.
更多的猫!请完成这个名为 NoisyCat 的类实现,它就像一只普通的 Cat。然而,NoisyCat 说话很多——是普通 Cat 的两倍!
我们在测试您的代码时可能会更改 Pet 和 Cat 的实现,因此请确保您正确使用了继承。
class NoisyCat: # Dose this line need to change?
"""A Cat that repeats things twice.
>>> chocola = NoisyCat('Chocola', 'Minazuki Kashou')
>>> isinstance(chocola, Cat) # check if chocola is an instance of Cat.
True
>>> chocola.talk()
Chocola says meow!
Chocola says meow!
"""
def __init__(self, name, owner, lives=9):
# Is this method necessary? If not, feel free to remove it.
"*** YOUR CODE HERE ***"
def talk(self):
"""Talks twice as much as a regular cat."""
"*** YOUR CODE HERE ***"