Skip to content

Latest commit

 

History

History

fractions-class

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

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.

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

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