Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started