-
I would
have class for each of automobile, bicycle, motorboat, sailboat,
submarine, airplane, hovercraft, balloon, horse-drawncarts.
Each of these would derive from base class vehicle.
-
I would have an interface for each of motor_powered_vehicle,
nature_powered_vehicle, personally_powered_vehicle, animal_powered_vehicle,
land_vehicle, air_vehicle, and water_vehicle.
-
Using interfaces allows me to group these categories of vehicle, possibly
with overlap but
still have them belong to their various classes.
For example, interface air_vehicle is implemented by airplane, hovercraft,
and balloon, which interface water_vehicle might be implemented by motorboat,
sailboat, submarine, and hovercraft.
Using interfaces also deals with the lack of multiple-inheritance in Java.
-
A method that I would want to include in the vehicle class, but not
override in any derived classes would be getName(), which gets
the name of the vehicle.
-
A method that I would want to over-ride would be getSpeedRange(), which
gets the speed range of the vehicle.