コード例 #1
0
        public bool divide(Quebrado q)
        {
            try
            {
                this.n = this.n * q.Denominador;
                this.d = this.d * q.Numerador;

                simplificar();

                return true;
            }
            catch
            {
                return false;
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
 public Quebrado(Quebrado q)
 {
     this.constructor(q.Numerador, q.Denominador);
 }