Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 572 Bytes

File metadata and controls

17 lines (13 loc) · 572 Bytes

You are provided with a skeleton of the class 'Fraction', which accepts two arguments (numerator, denominator).

EXAMPLE:

Fraction fraction1 = new Fraction(4, 5);

Your task is to make this class string representable, and addable while keeping the result in the minimum representation possible.

EXAMPLE:

System.out.println(fraction1.add(new Fraction(1, 8)));
// Outputs: 37/40

NB: DON'T use the built_in class 'fractions.Fraction'