Define a class called Fraction. This class is used to represent aration of two i
ID: 3619302 • Letter: D
Question
Define a class called Fraction. This class is used to represent aration of two integers.Please define at least the following methods:
1. a mutator function for user to set the numerator.
2. a mutator function for user to set the denominator.
3. a function to calculate the value of the fraction (numerator /denominator ) and
return it as type of double.
4. a function to output the value of the fraction reduced to lowestterms. (e.g.,
instead of outputting 20/60, the method should output 1/3). Thiswill require
finding the greatest common divisor for the numerator anddenominator, then
dividing both by that number Define a class called Fraction. This class is used to represent aration of two integers. Please define at least the following methods: 1. a mutator function for user to set the numerator. 2. a mutator function for user to set the denominator. 3. a function to calculate the value of the fraction (numerator /denominator ) and return it as type of double. 4. a function to output the value of the fraction reduced to lowestterms. (e.g., instead of outputting 20/60, the method should output 1/3). Thiswill require finding the greatest common divisor for the numerator anddenominator, then dividing both by that number