stepthom / math-fun

Just testing out some fun with mathematics.
2 stars 2 forks source link

Simplify fractions #13

Closed stepthom closed 11 years ago

stepthom commented 11 years ago

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.