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

Write a class that will allow you to add,( subtract, multiply,and divide) pair o

ID: 3612186 • Letter: W

Question

Write a class that will allow you to add,( subtract, multiply,and divide) pair of common fractions.

Notes:

1. Declare and define the fraction class, that will allow toinput the fraction data, to add multiply subtract and divide.

2. Declares objects to test the function members, and check theprogram

3.Put the result fraction in reduced form.

a. Find the greatest common divisor (gcd) of the numerator anddenominator.

b. Divide the numerator and denominator by the gcd.

The specificationof class Fraction is the following:

classFraction

{ intnumer;

   intdenom;

   intfind_gcd(int, int);

public:

  Fraction();

Fraction(int);

  Fraction(int, int);

   voidset( int, int);

   voidincrement();

   voidoperator +(const Fraction &fr2);

   voidreduce_fraction(int, int );

voidprint_fraction( );

  };

.

Explanation / Answer

please rate - thanks this should get you started #include #include #include #include class Fraction {public: void Inputc(); void Outputc(); Fraction operator+(Fraction x); Fraction operator-(Fraction x); Fraction operator*(Fraction x); Fraction operator/(Fraction x); int Fraction:: gcd(Fraction x); int Fraction:: find_gcd(int,int); void Fraction::reduce(Fraction& x); void Fraction::equiv(Fraction& ); private: int num,den; }; void Fraction::equiv(Fraction& x) {int denom,fact; denom=find_gcd(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