[Solved] JAVA: There are no Errors in my code, But i’m not getting the right answer [closed]


A problem is here

    this.Denom = this.Denom * frac.Denom;
    frac.Num = frac.Num * this.Denom;

Your setting this.Denom before you set frac.Num, you have to switch the order to

    frac.Num = frac.Num * this.Denom;
    this.Denom = this.Denom * frac.Denom;

0

solved JAVA: There are no Errors in my code, But i’m not getting the right answer [closed]