// note: this version is in a single file; an actual implementation // would have these in separate files public class Person { private String name; public Person(String name) { this.name = name; } public getName() { return name; } } interface HasCrew { Person firstInCommand(); Person secondInCommand(); } public class Engine extends Car implements HasCrew { private Person engineer, conductor; //... Person firstInCommand() { return engineer; } Person secondInCommand() { return conductor; } } public class Ship implements HasCrew { private Person captain, firstMate; private Person[] sailors; //... Person firstInCommand() { return captain; } Person secondInCommand() { return firstMate; } } public class PassengerPlane implements HasCrew { private Person pilot, copilot, navigator; //... Person firstInCommand() { return pilot; } Person secondInCommand() { return copilot; } }