public Fraction SubtractFraction(Fraction f) { //get common denominator var commonDenominator = _denominator * f.GetDenominator(); var addition = (_numerator * (_denominator / commonDenominator)) - (f.GetNumerator() * (f.GetDenominator() / commonDenominator)); return(new Fraction(addition, commonDenominator)); }
public Fraction AddFraction(Fraction f) { //get common denominator var commonDenominator = _denominator * f.GetDenominator(); var addition = (_numerator * (commonDenominator / _denominator)) + (f.GetNumerator() * (commonDenominator / f.GetDenominator())); return(new Fraction(addition, commonDenominator)); }
public Fraction DivideFraction(Fraction f) { //switch numerator/denominator on f and multiply return(MultiplyFraction(new Fraction(f.GetDenominator(), f.GetNumerator()))); }
public Fraction MultiplyFraction(Fraction f) { return(new Fraction(_numerator * f.GetNumerator(), _denominator * f.GetDenominator())); }