Implement the following class.the class has two instance variables num for the fraction numerator and den for the fraction denominator.
public class Fraction implements Comparable<Fraction>
public Fraction(int num, int den)
// initialize instance variables
public int den() // returns the denominator
public int num() // returns the numerator
public Fraction mediant(Fraction that, int n)
// returns the medianfraction of this and that fraction
public boolean equals(Object that)
// overrides the equals method
public String toString() // returns the fraction as a string “num/den”
The mediant of two fractions a/b and c/d , given an integer n is the fraction(a+c)/(b+d)only if b+d ≤n
i understand that if the denominator is ≤ 2 i can find the median by just adding the number.
so i want to understand what an integer n does.does it divide the fractions?should it always be 2?