Create a class RationalNumbers(fractions) with the followingcapabilities: a) Cre
ID: 3616930 • Letter: C
Question
Create a class RationalNumbers(fractions) with the followingcapabilities: a) Create a constructor that prevents a 0 denominator in afraction, reduces or simplifies fractions that are not in reducedform and avoids negative denominators. b) Overload the addition, subtraction, multiplication,and division operators for this class c) Overload the relational and equality operators forthis class Create a class RationalNumbers(fractions) with the followingcapabilities: a) Create a constructor that prevents a 0 denominator in afraction, reduces or simplifies fractions that are not in reducedform and avoids negative denominators. b) Overload the addition, subtraction, multiplication,and division operators for this class c) Overload the relational and equality operators forthis classExplanation / Answer
please rate - thanks This should get you started #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; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.