You were asked to use metrics and profiles to analyse and improve the Rational
class.
You can download a solution, including some tests.
Some things to think about:
Rational a; a.setDenominator(0); a.asDouble();
operator= return a Rational& rather
than Rational or const Rational& ?operator- and operator+ return a Rational?operator<< a friend (rather than a normal member)
?