예제 #1
0
 public Conversor()
 {
     InitializeComponent();
     CotizacionDolar.Text = Dolar.GetCotizacion().ToString();
     CotizacionEuro.Text  = Euros.GetCotizacion().ToString();
     CotizacionPeso.Text  = Pesos.GetCotizacion().ToString();
 }
예제 #2
0
 public Conversor()
 {
     InitializeComponent();
     txtCotizacionDolar.Text = (Dolar.GetCotizacion()).ToString();
     txtCotizacionEuro.Text  = (Euro.GetCotizacion()).ToString();
     txtCotizacionPeso.Text  = (Math.Round(Pesos.GetCotizacion(), 2)).ToString();
 }
예제 #3
0
        public Form1()
        {
            InitializeComponent();

            txtCotizacionEuro.Text  = Euro.GetCotizacion().ToString();
            txtCotizacionDolar.Text = Dolar.GetCotizacion().ToString();
            txtCotizacionPesos.Text = Pesos.GetCotizacion().ToString();
        }
예제 #4
0
 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();
 }
예제 #5
0
 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();
 }
예제 #6
0
 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();
 }
예제 #7
0
 private void CotizacionPeso_Leave(object sender, EventArgs e)
 {
     if (double.TryParse(CotizacionPeso.Text, out double auxCotizacion))
     {
         Pesos.SetCotizacion(auxCotizacion);
     }
     else
     {
         CotizacionPeso.Focus();
     }
 }
예제 #8
0
        private void BtnConvertPesos_Click(object sender, EventArgs e)
        {
            double aux;

            if (double.TryParse(txtPesos.Text, out aux))
            {
                Pesos dinero = aux;
                txtPesosAPesos.Text = dinero.GetCantidad().ToString();
                txtPesosADolar.Text = ((Dolar)dinero).GetCantidad().ToString();
                txtPesosAEuro.Text  = ((Euro)dinero).GetCantidad().ToString();
            }
        }
예제 #9
0
 private void txtCotizacionPeso_MouseLeave(object sender, EventArgs e)
 {
     if ((!(String.IsNullOrWhiteSpace(txtCotizacionPeso.Text))) && (Double.TryParse(txtCotizacionPeso.Text, out double cotizacionPesos)))
     {
         Pesos.SetCotizacion(cotizacionPesos);
     }
     else
     {
         txtCotizacionEuro.Focus();
         MessageBox.Show("Debe ingresar un valor valido", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #10
0
파일: Form1.cs 프로젝트: xTomluca/ProLab2
        private void btnConvertPesos_Click(object sender, EventArgs e)
        {
            double pesos = 0;

            if (double.TryParse(txtPesos.Text, out pesos))
            {
                Pesos auxPesos = new Pesos(pesos);
                txtPesosAPesos.Text = txtPesos.Text;
                txtPesosAEuro.Text  = (((Euro)auxPesos).GetCantidad()).ToString();
                txtPesosADolar.Text = (((Dolar)auxPesos).GetCantidad()).ToString();
            }
        }
예제 #11
0
파일: Form1.cs 프로젝트: Alandeb/Csharp-19
        private void button2_Click(object sender, EventArgs e)
        {
            Dolar d = new Dolar(Convert.ToDouble(textBox2.Text));

            textBox6.Text = d.GetCantidad().ToString();
            Euro e1;

            e1            = (Euro)d;
            textBox5.Text = e1.GetCantidad().ToString();
            Pesos p = (Pesos)d;

            textBox10.Text = p.GetCantidad().ToString();
        }
예제 #12
0
파일: Form1.cs 프로젝트: Alandeb/Csharp-19
        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();
        }
예제 #13
0
        private void TxtCotizacionPesos_Leave(object sender, EventArgs e)
        {
            double aux;

            if (double.TryParse(txtCotizacionPesos.Text, out aux))
            {
                Pesos.SetCotizacion(aux);
            }
            else
            {
                txtCotizacionPesos.Focus();
            }
        }
예제 #14
0
파일: Form1.cs 프로젝트: Alandeb/Csharp-19
        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();
        }
예제 #15
0
파일: Form1.cs 프로젝트: Nehlk/CSharp-UTN
        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");
            }
        }
예제 #16
0
        private void BotonPeso_Click(object sender, EventArgs e)
        {
            if (double.TryParse(EntradaPeso.Text, out double pesos))
            {
                Pesos moneda = new Pesos(pesos);

                Peso_Euro.Text  = ((Euros)moneda).GetCantidad().ToString();
                Peso_Dolar.Text = ((Dolar)moneda).GetCantidad().ToString();
                Peso_Peso.Text  = moneda.GetCantidad().ToString();
            }
            else
            {
                EntradaPeso.Focus();
            }
        }
예제 #17
0
 private void btnLockCotizacion_Click(object sender, EventArgs e)
 {
     if (btnLockCotizacion.ImageIndex == 0)
     {
         btnLockCotizacion.ImageIndex = 1;
         txtCotizacionPeso.Enabled    = true;
         txtCotizacionEuro.Enabled    = true;
     }
     else
     {
         Pesos.SetCotizacion(double.Parse(txtCotizacionPeso.Text));
         Euro.SetCotizacion(double.Parse(txtCotizacionEuro.Text));
         btnLockCotizacion.ImageIndex = 0;
         txtCotizacionPeso.Enabled    = false;
         txtCotizacionEuro.Enabled    = false;
     }
 }
예제 #18
0
        private void BtnConvertPesos_Click(object sender, EventArgs e)
        {
            double entrada;

            if (double.TryParse(this.txtPesos.Text, out entrada))
            {
                Pesos numero = new Pesos(entrada);
                this.txtPesosADolar.Text = ((Dolar)numero).GetCantidad().ToString();
                this.txtPesosAEuro.Text  = ((Euro)numero).GetCantidad().ToString();
                this.txtPesosAPesos.Text = numero.GetCantidad().ToString();
            }
            else
            {
                MessageBox.Show("Ingrese solo numeros!!");
                this.txtPesos.Focus();
            }
        }
예제 #19
0
 private void btnPeso_Click(object sender, EventArgs e)
 {
     if (!locked)
     {
         MessageBox.Show("Debe bloquearse el candado para asegurar las cotizaciones", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (Double.TryParse(txtPeso.Text, out double equivalentePesos))
         {
             Pesos myPeso = new Pesos(equivalentePesos);
             Pesos.SetCotizacion(Double.Parse(txtCotizacionPeso.Text));
             txtPesoEuro.Text  = (((Euros)myPeso).GetCantidad()).ToString();
             txtPesoDolar.Text = (((Dolar)myPeso).GetCantidad()).ToString();
             txtPesoPeso.Text  = (myPeso.GetCantidad()).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();
        }
예제 #21
0
파일: Form1.cs 프로젝트: Nehlk/CSharp-UTN
 private void CotizacionMonedas(double dolar, double peso, double euro)
 {
     Euro.SetCotizacion(euro);
     Dolar.SetCotizacion(dolar);
     Pesos.SetCotizacion(peso);
 }
예제 #22
0
        public static Pesos operator +(Pesos p, Euro e)
        {
            Pesos pesos = new Pesos(p.cantidad + ((Pesos)e).cantidad);

            return(pesos);
        }
예제 #23
0
        public static Pesos operator +(Pesos p, Dolar d)
        {
            Pesos pesos = new Pesos(p.cantidad + ((Pesos)d).cantidad);

            return(pesos);
        }
예제 #24
0
 public static float operator +(Euro e, Pesos p)
 {
     return((e + p) * Pesos.GetCotizacion());
 }
예제 #25
0
 public static float operator+(Dolar d, Pesos p)
 {
     return((d + p) * Pesos.GetCotizacion());
 }