Define a class called Fraction which defines rational numbers and how
they behave. A fraction has two integer attributes:
int num; //numerator
int den; //denominator
It should have two constructors:
1. Fraction (int n, int d) which initializes num to n and den to d.
2. Fraction (int n) which initializes num to n and d to 1.
Fraction should always be represented in their reduced form i.e. 2/6 as
1/3, 10/15 as 2/3 etc.
Write methods with the following specifications:
Fraction add(Fraction f1) - add fraction f1 to this i.e. the fraction
object on which it is called.
Fraction subtract(Fraction f1) - similar to add
Fraction multiply(Fraction f1) - similar to add
Fraction divide(Fraction f1) - similar to add
Fraction power(int n) - similar to add
boolean isLessThan(fraction f1) - true if this is less than f1
boolean isGreaterThan(fraction f1) - true if this is greater than f1
boolean isEqual(fraction f1) - true if this is equal to f1
Define and use helper functions as you need.