| SOLUTION 7.1 | Some problems with the given diagram follow:
The Rocket.thrust() method returns a Rocket instead of a number or a physical quantity. The LiquidRocket class has a getLocation() method, although nothing in the diagram or in the problem domain suggests that we model rockets as having a location. Even if we did, there is no reason for liquid-fueled rockets to have a location, whereas other Rocket objects do not. The isLiquid() method may be an acceptable alternative to using the instanceof operator, but then we'd expect the superclass to also have an isLiquid() method that would return false. CheapRockets is plural, although class names are conventionally singular. We could model cheapness with attributes ...
|