Question 2: Relations, Relations, Relations …
We constructed the Rat class to model fractions and to give us the ability to compute with them. Since fractions are numeric types, we might want to extend the set of operations on them to include the relational operators. (20 points)
So, if X and Y are Rats we want to be able say X==Y, X>Y, and X<Y. The obvious choice is to add them as member functions.
C++ provides operator==, operator> and operator< that can be overloaded for this purpose. They should be implemented so that they return bools.
a) Write operator==(…) that returns true if X==Y and false otherwise.
Note that all equivalent Rats should return true.
So if X = 1 / 2 and y= 2 / 4 the X==Y should return true. (10 points)
b) Write operator>(…) (5 points)
c)Write operator <(…) (5 points)
10 freelancers are bidding on average $21/hour for this job
I'm ready to overload those operations for you and provide 100% correct answers in 30 minutes as requested. Get in touch to kick-start the implementation right now.