public Conversor() { InitializeComponent(); CotizacionDolar.Text = Dolar.GetCotizacion().ToString(); CotizacionEuro.Text = Euros.GetCotizacion().ToString(); CotizacionPeso.Text = Pesos.GetCotizacion().ToString(); }
private void btnConvEuro_Click(object sender, EventArgs e) { if (Validacion.validTxtWithNum(txtEuroAmmount.Text)) { double.TryParse(txtEuroAmmount.Text, out euroAmmount); Euro valorE = euroAmmount; Pesos valorP = Dolar.ConvertToDolar(valorE) * Pesos.GetCotizacion(); Dolar valorD = Dolar.ConvertToDolar(valorE); StringBuilder outputE = new StringBuilder(); StringBuilder outputP = new StringBuilder(); StringBuilder outputD = new StringBuilder(); outputE.AppendFormat("€{0:##.##}", valorE.GetCantidad()); outputP.AppendFormat("${0:##.##}", valorP.GetCantidad()); outputD.AppendFormat("u$s {0:##.##}", valorD.GetCantidad()); txtEuroToEuro.Text = outputE.ToString(); txtEuroToPeso.Text = outputP.ToString(); txtEuroToDolar.Text = outputD.ToString(); } else { MessageBox.Show("Verifique que el monto sea correcto"); } }
public Conversor() { InitializeComponent(); txtCotizacionDolar.Text = (Dolar.GetCotizacion()).ToString(); txtCotizacionEuro.Text = (Euro.GetCotizacion()).ToString(); txtCotizacionPeso.Text = (Math.Round(Pesos.GetCotizacion(), 2)).ToString(); }
public Form1() { InitializeComponent(); txtCotizacionEuro.Text = Euro.GetCotizacion().ToString(); txtCotizacionDolar.Text = Dolar.GetCotizacion().ToString(); txtCotizacionPesos.Text = Pesos.GetCotizacion().ToString(); }
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(); }
public static float operator +(Euro e, Pesos p) { return((e + p) * Pesos.GetCotizacion()); }
public static float operator+(Dolar d, Pesos p) { return((d + p) * Pesos.GetCotizacion()); }