Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Define a rational number class. A rational number is a numbercomposed of two int

ID: 3611498 • Letter: D

Question

Define a rational number class. A rational number is a numbercomposed of two integers with division indicated as in 1/2, 2/3,4/5. A rational number is defined using two integer objects, anumerator and a denominator. Overload the << and >>operators as well as each of the arithmetic operators to performthe following operations:
a/b + c/d = (a*d + b*c) //addition
a/b - c/d = (a*d - b*c) //subtraction
(a/b) * (c/d) = (a*c) / (b*d) //multiplication
(a/b) / (c/d) = (a*d) / (c*b) //division

Thanks for all the help!

Explanation / Answer

should get you started please rate - thanks #include #include #include #include class Rational {public: void Inputc(); void Outputc(); Rational operator+(Rational x); Rational operator-(Rational x); Rational operator*(Rational x); Rational operator/(Rational x); int Rational:: gcd(Rational x); void Rational::reduce(Rational& x); private: int num,den; }; Rational Rational::operator + (Rational x) {Rational temp; temp.num=num+x.num; temp.den=x.den; //cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote