Question: Enhance the class Rational by filling out the class interface provided below and implementing additional overloaded binary operators as listed. Also use the C +
Enhance the class Rational by filling out the class interface provided below and implementing additional overloaded binary operators as listed. Also use the C exceptionhandling feature to ensure a valid rational number is used when a Rational object is instantiated. Check your code against the Rational class test provided, and only submit your Rational.cc file.
class Rational
friend std::ostream& operatorstd::ostream& const Rational&;
public:
Rational: numerator denominator
Rationalint int; Constructor now validates object
void reduce;
void setnumberint int;
Rational operatorconst Rational& const; Addition
Subtraction
Multiplication
Division
Lessthan
Greaterthan
Equalto
Notequalto
private:
int numerator;
int denominator;
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
