public bool divide(Quebrado q) { try { this.n = this.n * q.Denominador; this.d = this.d * q.Numerador; simplificar(); return true; } catch { return false; } }
public bool suma(Quebrado q) { try { if (q.Denominador != this.d) { this.n = this.n * q.Denominador + q.Numerador * this.d; this.d = this.d * q.Denominador; } else { this.n = this.n + q.Numerador; } simplificar(); return true; } catch { return false; } }
public Quebrado(Quebrado q) { this.constructor(q.Numerador, q.Denominador); }