// Definition of a rational number class; a rational number object 
// will be a fraction, with a numerator and a non-zero denominator.
// Throughout, any operation which results in a denominator being zero
// generates an error.

// A class is a type (or abstract data type), with both data and operations

class Rational
{  /* the following extends the standard arthmetic operator + to rationals */

public:  /* this presents the user's view of rational numbers */

  /* The first operations allow varying declarations of rational numbers */
  Rational (void); /* A rational with no designated value will be 0 or 0/1 */
  Rational (int num); /* A rational with a numerator only will be num/1    */
  Rational (int num, int denom);  /* The rational num/denom                */

  /* I/O operations */
  void read(void); /* reads a rational of the form num / denom */
  void print(void);

  /* Return rational number as a decimal */
  double eval (void);

  friend Rational operator+ (Rational r2);

private:  /* the following details are for implementation only and 
             are not accessible by users */
  int numerator;
  int denominator;
};
