//metodi public Fraction Moltiplication(Fraction otherf) { int numres = this.numerator * otherf.numerator; int denres = this.denominator * otherf.denominator; Fraction res = new Fraction(numres, denres); res.Reduction(); return(res); }
public Fraction Add(Fraction otherf) { int denres; int numres1; int numres2; int numres; denres = (this.denominator * otherf.denominator); numres1 = (denres / this.denominator) * this.numerator; numres2 = (denres / otherf.denominator) * otherf.numerator; numres = numres1 + numres2; Fraction res = new Fraction(numres, denres); res.Reduction(); return(res); }
public Fraction Sub(Fraction otherf) { //int denris = this.denominatore * altraf.denominatore; int denres; int numres1; int numres2; int numres; denres = (this.denominator * otherf.denominator); numres1 = (denres / this.denominator) * this.numerator; numres2 = (denres / otherf.denominator) * otherf.numerator; numres = numres1 - numres2; Fraction ris = new Fraction(numres, denres); ris.Reduction(); return(ris); }