Hi everyone, I wrote the following code for a Fraction class that implements an interface called StdMathOps which consists of 5 methods called add, sub, div mult, and toString. I am getting a compilation error which says "Fraction is not abstract and does not override abstract method mult(Object) in StdMathOps." I do not intend for Fraction to be an abstract class as it does implement each of the 5 methods in the interface, and am wondering if anyone can help me in identifying what needs to be corrected. Any help would be greatly appreciated.
Here is the interface:
Here is the Fraction class:
public class Fraction implements StdMathOps { private int num; private int den; public Fraction(int a, int b) { num = a; den = b; } public Fraction() { num = 1; den = 1; } @Override public String toString() { return num + "/" + den; } public double getDecimal() { double decimal = ((double)num / den); return decimal; } public String reduce() { int n = num; int d = den; while(n != d) { if(n > d) n = n - d; if(d > n) d = d - n; } return((num / d) + "/" + (den / d)); } public String toMixed() { int a = num; int b = den; int whole = num / den; while(a != b) { if(a > b) a = a - b; if(b > a) b = b - a; } Fraction g = new Fraction(num % den / b, den / b); if(whole > 0) return whole + " " + g.toString(); else return g.toString(); } public Fraction add(Fraction a) { int newNum = (((a.den * den) / a.den) * a.num) + (((den * a.den) / den) * num); int newDen = (a.den * den ); Fraction x = new Fraction(newNum, newDen); return x; } public Fraction sub(Fraction a) { int newNum = ((num * a.den) - (a.num * den)); int newDen = den * a.den; Fraction x = new Fraction (newNum, newDen); return x; } public Fraction div(Fraction a) { int newNum = num * a.den; int newDen = den * a.num; Fraction x = new Fraction (newNum, newDen); return x; } public Fraction mult(Fraction a) { int newNum = num * a.num; int newDen = den * a.den; Fraction x = new Fraction (newNum, newDen); return x; } }