A rational number is a ratio of two integers with a nonzero denominator. Modeling it as a class requires honoring that invariant: doubles are the wrong representation, and division by zero must be rejected. section 7.4
The naïve class makes calculations awkward by offering plus and times methods instead of expected operators. It also exposes setters, permits invalid state, and hides bugs behind code that initially looks reasonable. A safer design stores integers, validates the denominator, reduces the ratio, and supports +, *, and stream output directly. section 7.4


