Define a class called fraction this class is used to


Question: Define a class called Fraction. This class is used to represent a ratio of two integers. Include mutator methods that allow the user to set the numerator and the denominator. Also include a method that returns the value of numerator divided by denominator as a double. Include an additional method that outputs the value of the fraction reduced to lowest terms (e.g., instead of outputting 20/60, the method should output 1/3). This will require finding the greatest common divisor for the numerator and denominator, then dividing both by that number. Embed your class in a test program.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Define a class called fraction this class is used to
Reference No:- TGS02404452

Now Priced at $15 (50% Discount)

Recommended (90%)

Rated (4.3/5)