The abstract class EnergySource could easily have been made into an
interface instead, because it only consists of public abstract
methods.  Making it an interface allows for more class design
flexibility; classes can implement EnergySource as well as extending
another class's implementation.  Here is the same EnergySource as an
interface:

    interface EnergySource {

	boolean empty();

	// ...
    }

The only other difference to the solution to Exercise 3.7 is to change

    class GasTank extends EnergySource {
    class Battery extends EnergySource {

into

    class GasTank implements EnergySource {
    class Battery implements EnergySource {

since a class must "implement" rather than "extend" an interface.
