WRITE A PROGRAM IN JAVA OR C++ Define a class called Fraction. This class is use
ID: 3619229 • Letter: W
Question
WRITE A PROGRAM IN JAVA OR C++Define a class called Fraction. This class is used torepresent a ration 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 tolowest 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 anddenominator, then dividing both by that number WRITE A PROGRAM IN JAVA OR C++
Define a class called Fraction. This class is used torepresent a ration 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 tolowest 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 anddenominator, then dividing both by that number