#include "Rational.h" // constructor Rational::Rational(int n, int d) { set(n, d); } bool Rational::set(int n, int d) { if (d != 0) { num_ = n; den_ = d; return true; } else return false; } // accessor functions int Rational::num() const { return num_; } int Rational::den() const { return den_; } // returns decimal equivalent double Rational::decimal() const { return num_ / double(den_); }