Add functionality to the Fraction class to automatically simplify the fraction. E.g., if the numerator is 10 and the denominator is 2, these should be simplified to 5 and 1.
Probably the best place to implement this is in the public Fraction(int n, int d) constructor method.
Please also add some unit test cases to ensure this is working correctly.
Add functionality to the Fraction class to automatically simplify the fraction. E.g., if the numerator is 10 and the denominator is 2, these should be simplified to 5 and 1.
Probably the best place to implement this is in the
public Fraction(int n, int d)
constructor method.Please also add some unit test cases to ensure this is working correctly.