private void btnConvPeso_Click(object sender, EventArgs e) { if (Validacion.validTxtWithNum(txtPesoAmmount.Text)) { double.TryParse(txtPesoAmmount.Text, out pesoAmmount); Pesos valorP = pesoAmmount; Euro valorE = Dolar.ConvertToDolar(valorP) * Euro.GetCotizacion(); Dolar valorD = Dolar.ConvertToDolar(valorP); StringBuilder outputE = new StringBuilder(); StringBuilder outputP = new StringBuilder(); StringBuilder outputD = new StringBuilder(); if (valorD.GetCantidad() < 0.05) { outputD.AppendFormat("u$s{0:#.####}", valorD.GetCantidad()); } else { outputD.AppendFormat("u$s{0:#.##}", valorD.GetCantidad()); } if (valorE.GetCantidad() < 0.05) { outputE.AppendFormat("€{0:#.####}", valorE.GetCantidad()); } else { outputE.AppendFormat("€{0:#.##}", valorE.GetCantidad()); } outputP.AppendFormat("${0:#.##}", valorP.GetCantidad()); txtPesoToEuro.Text = outputE.ToString(); txtPesoToPeso.Text = outputP.ToString(); txtPesoToDolar.Text = outputD.ToString(); } else { MessageBox.Show("Verifique que el monto sea correcto"); } }
private void btnConvDolar_Click(object sender, EventArgs e) { if (Validacion.validTxtWithNum(txtDolarAmmount.Text)) { double.TryParse(txtDolarAmmount.Text, out dolarAmmount); Euro valor = dolarAmmount * Euro.GetCotizacion(); Pesos valorP = dolarAmmount * Pesos.GetCotizacion(); Dolar valorD = dolarAmmount; StringBuilder outputE = new StringBuilder(); StringBuilder outputP = new StringBuilder(); StringBuilder outputD = new StringBuilder(); outputE.AppendFormat("€{0:##.##}", valor.GetCantidad()); outputP.AppendFormat("${0:##.##}", valorP.GetCantidad()); outputD.AppendFormat("u$s {0:##.##}", valorD.GetCantidad()); txtDolarToEuro.Text = outputE.ToString(); txtDolarToPeso.Text = outputP.ToString(); txtDolarToDolar.Text = outputD.ToString(); } else { MessageBox.Show("Verifique que el monto sea correcto"); } }
private void btnConvertPeso_Click(object sender, EventArgs e) { peso = new Pesos(double.Parse(txtPeso.Text)); euro = (Euro)peso; dolar = (Dolar)peso; txtPesoADolar.Text = (dolar.GetCantidad()).ToString(); txtPesoAEuro.Text = (euro.GetCantidad()).ToString(); txtPesoAPeso.Text = (peso.GetCantidad()).ToString(); }
private void btnConvertDolar_Click(object sender, EventArgs e) { dolar = new Dolar(double.Parse(txtDolar.Text)); euro = (Euro)dolar; peso = (Pesos)dolar; txtDolarADolar.Text = (dolar.GetCantidad()).ToString(); txtDolarAEuro.Text = (euro.GetCantidad()).ToString(); txtDolarAPeso.Text = (peso.GetCantidad()).ToString(); }
private void btnConvertEuro_Click(object sender, EventArgs e) { euro = new Euro(double.Parse(txtEuro.Text)); peso = (Pesos)euro; dolar = (Dolar)euro; txtEuroAEuro.Text = (euro.GetCantidad()).ToString(); txtEuroADolar.Text = (dolar.GetCantidad()).ToString(); txtEuroAPeso.Text = (peso.GetCantidad()).ToString(); }
private void BtnConvertEuro_Click(object sender, EventArgs e) { double aux; if (double.TryParse(txtEuro.Text, out aux)) { Euro dinero = aux; txtEuroAEuro.Text = (dinero.GetCantidad()).ToString(); txtEuroADolar.Text = ((Dolar)dinero).GetCantidad().ToString(); txtEuroAPesos.Text = ((Pesos)dinero).GetCantidad().ToString(); } }
private void button3_Click(object sender, EventArgs e) { Pesos p = new Pesos(Convert.ToDouble(textBox3.Text)); textBox11.Text = p.GetCantidad().ToString(); Dolar d; d = (Dolar)p; textBox12.Text = d.GetCantidad().ToString(); Euro e1 = (Euro)p; textBox9.Text = e1.GetCantidad().ToString(); }
private void button1_Click(object sender, EventArgs e) { Euro e1 = new Euro(Convert.ToDouble(textBox1.Text)); textBox4.Text = e1.GetCantidad().ToString(); Dolar d; d = (Dolar)e1; textBox7.Text = d.GetCantidad().ToString(); Pesos p = (Pesos)e1; textBox8.Text = p.GetCantidad().ToString(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnConvertEuro_Click(object sender, EventArgs e) { if (!lockedOK) { MessageError("You need to complete al the cotizations boxes", "Error"); } else { if (Double.TryParse(txtEuro.Text, out double equivalentEuro)) { Euro myEuro = new Euro(equivalentEuro); txtEuroAEuro.Text = myEuro.GetCantidad().ToString(); txtEuroADolar.Text = ((Dolar)myEuro).GetCantidad().ToString(); txtEuroAPeso.Text = ((Peso)myEuro).GetCantidad().ToString(); } } }
private void BtnConvertEuro_Click(object sender, EventArgs e) { double entrada; if (double.TryParse(this.txtEuro.Text, out entrada)) { Euro numero = new Euro(entrada); this.txtEuroADolar.Text = (((Dolar)numero).GetCantidad()).ToString(); this.txtEuroAEuro.Text = numero.GetCantidad().ToString(); this.txtEuroAPesos.Text = (((Pesos)numero).GetCantidad()).ToString(); } else { MessageBox.Show("Ingrese solo numeros!!"); this.txtEuro.Focus(); } }
private void btnConvertPeso_Click(object sender, EventArgs e) { int aux; if (int.TryParse(textPeso.Text, out aux)) { Peso peso = new Peso(aux); Dolar dolar = new Dolar(aux); Euro euro = new Euro(aux); textPesoAPeso.Text = aux.ToString(); Dolar auxD = (Dolar)peso; textPesoADolar.Text = string.Format("{0:n2}", Math.Truncate(auxD.GetCantidad() * 100) / 100); Euro auxE = (Euro)peso; textPesoAEuro.Text = string.Format("{0:n2}", Math.Truncate(auxE.GetCantidad() * 100) / 100); } }
private void btnConvertDolar_Click(object sender, EventArgs e) { int aux; if (int.TryParse(textDolar.Text, out aux)) { Dolar dolar = new Dolar(aux); Peso peso = new Peso(aux); Euro euro = new Euro(aux); textDolarADolar.Text = aux.ToString(); Peso auxP = (Peso)dolar; textDolarAPeso.Text = string.Format("{0:n2}", Math.Truncate(auxP.GetCantidad() * 100) / 100); Euro auxE = (Euro)dolar; textDolarAEuro.Text = string.Format("{0:n2}", Math.Truncate(auxE.GetCantidad() * 100) / 100); } }
static void Main(string[] args) { Console.Title = "Ejercicio 20"; Euro e = new Euro(2); Dolar d = new Dolar(2); Pesos p = new Pesos(2); Console.WriteLine("Cotizacion pesos: {0}\nCotizacion euro: {1}", Pesos.GetCotizacion(), Euro.GetCotizacion()); Console.WriteLine("Cantidad de dolares: {0}\nCantidad de pesos: {1}\nCantidad de euros: {2}", d.GetCantidad(), p.GetCantidad(), e.GetCantidad()); Console.WriteLine("Total pesificado: {0}", ((p + d) + e).GetCantidad()); Console.WriteLine("Total dolarizado: {0}", ((d + p) + e).GetCantidad()); Console.WriteLine("Total en euros: {0}", ((e + d) + p).GetCantidad()); Console.ReadKey(); }