So here's my code. I had to do 3 constructor and 2 division methods. I have finished the 3 constructors. My question is on the division, where :(1) I have to divide a fraction by an integer and return, (2)divide an integer by a fraction and return.

public class IFraction extends Fraction {

    public IFraction(int I) throws DivideByZero {
        super (I,1);

public IFraction(Int x, Int y) throws DivideByZero
    super(x, y)

public IFraction(Int q) throws DivideByZero

public static IFraction Division(int L, Fraction R) throws DivideByZero
    if(L == 0) throw new DivideByZero();
    IFraction Answer = new IFraction(L * R.Numerator(),
    return Answer; 

public static IFraction Division(Fraction L, Int R) throws DivideByZero
    if(L.Numerator() ==0) throw new DivideByZero();
        IFraction Answer = new IFraction(L.Numerator() * R 


That's my attempt on the divide, but it's wrong of course. Just need help on that part. Appreciate any help!

4 Years
Discussion Span
Last Post by M4trixSh4d0w
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.