It takes 0.2 seconds per letter for an animal to make a noise, so “meow” takes 0.8 seconds and “meeeou” is 1.2 seconds. There are two methods to think about:
Noisy
makes; andNoisy
thing in Java.Dolphin
class that makes the “click” noise.A class is Colorable
if it has the methods void setColor(int c)
and int getColor()
.
Colorable
abilities to your Dolphin
.A Cat
is a Noisy
thing that makes one of three noises: “meow”,
“purr”, or “rrrrrrr”. When you construct a cat it should get a number
0, 1, or 2 that it uses to choose which noise to make.
A RandomCat
is a kind of Cat
that makes an unspecified random
noise. Each random cat could make a different noise, but a given
random cat will always make the same noise.
A VeryRandomCat
makes a different random noise every time it makes a
noise. Figure out a way to create this class without duplicating code
from other classes, possibly by going back to rewrite what you have in
a different way.