Create a public class named Dog
.
Dog
should inherit from the Canine
class shown below:
(You do not need to define Canine
.)
You should provide a public constructor that allows the age of the Dog
to be set (as a double
)
when it is created.
assert
that the passed age is not negative.
You should not expose the age and do not need to provide either a setter or a getter for it.
You should pass the kind "dog" to the Canine
constructor when creating a Dog
.
Dog
should override toString
and return a String
in the following format: "This dog is (age) years old".
Stuck? You may find these lessons helpful: