public IFasor SumarEnSen(IFasor sumando) { NumeroComplejoBinomico sumando1 = this.EnSen().EnBinomico(); NumeroComplejoBinomico sumando2 = sumando.EnSen().EnBinomico(); INumeroComplejo resultado = OperacionesService.Sumar(sumando1, sumando2); return(new FasorCoseno(resultado.GetModulo(), this.periodo, resultado.GetArgumento())); }
private void CalcularButton_Click(object sender, EventArgs e) { if (INumeroComplejo.Equals(operando1, null) || INumeroComplejo.Equals(operando2, null)) { resultadoLabel.Text = "Falta asignar algun operando, asignelo y vuelva a intentar"; } else { if (SumaButton.Checked) { //logica de la suma. en lo posible delegar todas las cuentas a un servicio asi queda limpia esta parte del codigo ? resultado = OperacionesService.Sumar(operando1, operando2); } if (RestaButton.Checked) { //resta resultado = OperacionesService.Resta(operando1, operando2); } if (MultiplicacionButton.Checked) { //multiplicacion resultado = OperacionesService.Multiplicar(operando1, operando2); } if (DivisionButton.Checked) { if (operando2.GetFormaPolar().GetModulo() != 0) { resultado = OperacionesService.Dividir(operando1, operando2); } else { resultadoLabel.Text = "No es posible dividir por cero"; return; } } resultadoLabel.Text = resultado.Show(); } }