beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Simple Dog Inheritance

Geoffrey Challen // 2021.3.0

Create a class named Dog. Dog should inherit from the Canine class shown below:

(You do not need to define Canine.)

You should provide a primary constructor that allows the age of the Dog to be set (as a double) when it is created. require that the passed age is not negative. Your property storing the age should not be publicly visible. 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".