예제 #1
0
        private void btnConverPeso_Click(object sender, EventArgs e)
        {
            double peso;
            Euro   euroPeso;
            Dolar  pesosDolar;


            if (double.TryParse(txtPeso.Text, out peso))
            {
                txtPesoAPeso.Text = Convert.ToString(peso);


                Pesos nuevoPeso = new Pesos(peso);

                euroPeso = (Euro)nuevoPeso;

                txtPesoAEuro.Text = Convert.ToString(euroPeso.GetCantidad());
                //bien
                pesosDolar         = (Dolar)nuevoPeso;
                txtPesoADolar.Text = Convert.ToString(pesosDolar.GetCantidad());
            }
            else
            {
                txtPesoAPeso.Text  = "Invalido";
                txtPesoAEuro.Text  = "Invalido";
                txtPesoADolar.Text = "Invalido";
            }
        }
예제 #2
0
 public FormMonedas()
 {
     InitializeComponent();
     txtCotizacionEuro.Text  = Euro.GetCotizacion().ToString();
     txtCotizacionDolar.Text = Dolar.GetCotizacion().ToString();
     txtCotizacionPeso.Text  = Pesos.GetCotizacion().ToString();
 }
예제 #3
0
        static void Main(string[] args)
        {
            Euro  e = new Euro(10, 0.809f);
            Dolar d = new Dolar(10);
            Pesos p = new Pesos(10, 20.1655f);

            Pesos p2 = 10;
            Pesos p3 = new Pesos(10);

            Euro aux_e = e + d;

            Console.WriteLine("Euro + Dólar (€18,09xx): {0}", aux_e.GetCantidad());
            aux_e = e + p;
            Console.WriteLine("Euro + Pesos (€10,40xx): {0}", aux_e.GetCantidad());
            Console.WriteLine("----------------------------------------------");

            Dolar aux_d = d + e;

            Console.WriteLine("Dólar + Euro (U$S22,36xx): {0}", aux_d.GetCantidad());
            aux_d = d + p;
            Console.WriteLine("Dólar + Pesos (U$S10,49xx): {0}", aux_d.GetCantidad());
            Console.WriteLine("----------------------------------------------");

            Pesos aux_p = p + e;

            Console.WriteLine("Pesos + Euro ($259,26xx): {0}", aux_p.GetCantidad());
            aux_p = p + d;
            Console.WriteLine("Pesos + Dólar ($211,65xx): {0}", aux_p.GetCantidad());

            Console.ReadKey();
        }
예제 #4
0
 public Form1()
 {
     InitializeComponent();
     txtCotizacionDolar.Text = (Dolar.GetCotizacion()).ToString();
     txtCotizacionEuro.Text  = (Euro.GetCotizacion().ToString());
     txtCotizacionPeso.Text  = (Pesos.GetCotizacion().ToString());
 }
예제 #5
0
        private void BtnConvertPeso_Click(object sender, EventArgs e)
        {
            Pesos input = new Pesos(Convert.ToDouble(txtPesoIn.Text));

            txtPesoPeso.Text  = input.GetCantidad().ToString("0.00");
            txtPesoDolar.Text = ((Dolar)input).GetCantidad().ToString("0.00");
            txtPesoEuro.Text  = ((Euro)input).GetCantidad().ToString("0.00");
        }
예제 #6
0
        private void btn_pesos_Click(object sender, EventArgs e)
        {
            Pesos pes = new Pesos(double.Parse(txtPesos.Text));

            txtPesosPesos.Text = string.Format("{0}", pes.GetCantidad());
            txtPesosDolar.Text = string.Format("{0}", ((Dolares)pes).GetCantidad());
            txtPesosEuro.Text  = string.Format("{0}", ((Euros)pes).GetCantidad());
        }
예제 #7
0
        private void BtnConvertPesos_Click(object sender, EventArgs e)
        {
            Pesos peso = new Pesos(double.Parse(txtPesos.Text));

            this.txtPesosAEuro.Text  = (((Euro)peso).cantidad).ToString();
            this.txtPesosADolar.Text = (((Dolar)peso).cantidad).ToString();
            this.txtPesosAPesos.Text = (peso.cantidad).ToString();
        }
 private void btnConvertirEuro_Click(object sender, EventArgs e)
 {
     Euro e1 = new Euro(double.Parse(txtCantidadEuro.Text));
     Dolar d1 = (Dolar)e1;
     Pesos p1 = (Pesos)e1;
     txtEuroPeso.Text = p1.GetCantidad().ToString();
     txtEuroEuro.Text = e1.GetCantidad().ToString();
     txtEuroDolar.Text = d1.GetCantidad().ToString();
 }
 private void btnConvertirDolar_Click(object sender, EventArgs e)
 {
     Dolar d1 = new Dolar(double.Parse(txtCantidadDolar.Text));
     Euro e1 = (Euro)d1;
     Pesos p1 = (Pesos)d1;
     txtDolarEuro.Text = e1.GetCantidad().ToString();
     txtDolarDolar.Text = d1.GetCantidad().ToString();
     txtDolarPeso.Text = p1.GetCantidad().ToString();
 }
 private void btnConvertirPeso_Click(object sender, EventArgs e)
 {
     Pesos p1 = new Pesos(double.Parse(txtCantidadPesos.Text));
     Euro e1 = (Euro)p1;
     Dolar d1 = (Dolar)p1;
     txtPesoEuro.Text = e1.GetCantidad().ToString();
     txtPesoDolar.Text = d1.GetCantidad().ToString();
     txtPesoPeso.Text = p1.GetCantidad().ToString();
 }
예제 #11
0
        public static void SetCotizaciones()
        {
            Pesos.SetCotizacion(0.010526);
            Dolar.SetCotizacion(1);
            DolarBlue.SetCotizacion(1.515);
            DolarCCL.SetCotizacion(1.5568);
            DolarAhorro.SetCotizacion(1.65);

            DolarTurista.SetCotizacion(4);
        }
예제 #12
0
파일: CPesos.cs 프로젝트: jenesepas/csharp
    public static void Main(string[] args)
    {
        int   numAlumnos;
        Pesos p = new Pesos();

        System.Console.Write("Introduce el número de alumnos: ");
        numAlumnos = Leer.datoInt();
        p.CrearObj(numAlumnos);
        p.Mostrar();
    }
 public Conversor()
 {
     InitializeComponent();
     btnLock.BackgroundImage = Image.FromFile(@"C:\Users\Calidad\Desktop\Programas\Program\practicaProgramacionII\Conversor\bloqueado (1).png");
     txtCotiEuro.Text = "1,16";
     txtCotiPeso.Text = "55,93";
     txtCotiDolar.Text = "1";
     Euro.SetCotizacion(txtCotiEuro.Text);
     Dolar.SetCotizacion(txtCotiDolar.Text);
     Pesos.SetCotizacion(txtCotiPeso.Text);
 }
예제 #14
0
        private void btnConvertirPeso_Click(object sender, EventArgs e)
        {
            double aux = default(double);

            if (double.TryParse(txtPeso.Text, out aux))
            {
                Pesos pesito = new Pesos(aux);
                txtPesoAEuro.Text  = ((Euro)pesito).GetCantidad().ToString();
                txtPesoADolar.Text = ((Dolar)pesito).GetCantidad().ToString();
                txtPesoAPeso.Text  = pesito.GetCantidad().ToString();
            }
        }
예제 #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            double d;

            if (double.TryParse(textBox1.Text, out d))
            {
                Pesos p = new Pesos(d);
                textBox4.Text  = string.Format("{0,10:#,###.00}", p.GetCantidad());
                textBox7.Text  = string.Format("{0,10:#,###.00}", ((Dolares)p).GetCantidad());
                textBox10.Text = string.Format("{0,10:#,###.00}", ((Euros)p).GetCantidad());
            }
        }
예제 #16
0
 private void btnConvertPeso_Click(object sender, EventArgs e)
 {
     if (Double.TryParse(txtPeso.Text, out double equivalenteEuro))
     {
         //Pesos.SetCotizacion(equivalenteEuro);
         Pesos peso = new Pesos(equivalenteEuro);
         ((Euro)peso).GetCantidad();
         txtPesoAEuro.Text  = ((Euro)peso).GetCantidad().ToString();
         txtPesoADolar.Text = ((Dolar)peso).GetCantidad().ToString();
         txtPesoAPeso.Text  = peso.GetCantidad().ToString();
     }
 }
예제 #17
0
        private void FormConversor_Load(object sender, EventArgs e)
        {
            string valorDolar = Dolar.GetCotizacion().ToString();

            txtCotizacionDolar.Text = valorDolar;
            string valorEuro = Euro.GetCotizacion().ToString();

            txtCotizacionEuro.Text = valorEuro;
            string valorPeso = Pesos.GetCotizacion().ToString();

            txtCotizacionPesos.Text = valorPeso;
        }
예제 #18
0
        private void btnConvertPeso_Click(object sender, EventArgs e)
        {
            double aux;

            if (double.TryParse(txtPeso.Text, out aux))
            {
                Pesos peso1 = new Pesos(aux);
                txtPesoAPeso.Text  = (peso1.GetCantidad()).ToString("N", new CultureInfo("is-IS"));
                txtPesoADolar.Text = ((Dolar)(peso1)).GetCantidad().ToString("N", new CultureInfo("is-IS"));
                txtPesoAEuro.Text  = ((Euro)(peso1)).GetCantidad().ToString("N", new CultureInfo("is-IS"));
            }
        }
        private void btnConvertPeso_Click(object sender, EventArgs e)
        {
            double aux = 0;

            if (double.TryParse(txtPeso.Text, out aux))
            {
                Pesos moneda = new Pesos(aux);
                txtPesoAEuro.Text  = ((Euro)moneda).GetCantidad().ToString();
                txtPesoADolar.Text = ((Dolar)moneda).GetCantidad().ToString();
                txtPesoAPeso.Text  = moneda.GetCantidad().ToString();
            }
        }
예제 #20
0
        private void btnConvertPesos_Click(object sender, EventArgs e)
        {
            peso = new Pesos(Convert.ToDouble(this.txtPesos.Text));
            this.txtPesosAPesos.Text = peso.GetCantidad().ToString();

            dolar = new Dolar(1);
            dolar = (Dolar)peso;
            this.txtPesosADolar.Text = dolar.GetCantidad().ToString();

            euro = new Euro(1);
            euro = (Euro)peso;
            this.txtPesosAEuro.Text = euro.GetCantidad().ToString();
        }
예제 #21
0
        private void btnConvertDolar_Click(object sender, EventArgs e)
        {
            dolar = new Dolar(Convert.ToDouble(this.txtDolar.Text));
            this.txtDolarADolar.Text = dolar.GetCantidad().ToString();

            peso = new Pesos(1);
            peso = (Pesos)dolar;
            this.txtDolarAPesos.Text = peso.GetCantidad().ToString();

            euro = new Euro(1);
            euro = (Euro)dolar;
            this.txtDolarAEuro.Text = euro.GetCantidad().ToString();
        }
예제 #22
0
        private void btnConverEuro_Click(object sender, EventArgs e)
        {
            euro = new Euro(Convert.ToDouble(this.txtEuro.Text));
            this.txtEuroAEuro.Text = euro.GetCantidad().ToString();

            peso = new Pesos(1);
            peso = (Pesos)euro;
            this.txtEuroAPesos.Text = peso.GetCantidad().ToString();

            dolar = new Dolar(1);
            dolar = (Dolar)euro;
            this.txtEuroADolar.Text = dolar.GetCantidad().ToString();
        }
예제 #23
0
        private void txtCotizacionPeso_Leave(object sender, EventArgs e)
        {
            double cotiz;

            if (double.TryParse(txtCotizacionPeso.Text, out cotiz))
            {
                Pesos.SetCotizacion(cotiz);
            }
            else
            {
                txtCotizacionPeso.Text = Pesos.GetCotizacion().ToString();
            }
        }
예제 #24
0
        private void TxtCotizacionPesos_Leave(object sender, EventArgs e)
        {
            double aux;

            if (double.TryParse(txtCotizacionPeso.Text, out aux))
            {
                Pesos.SetCotizacion(aux);
            }
            else
            {
                txtCotizacionPeso.Focus();
            }
        }
예제 #25
0
        private void txtCotizacionPeso_Leave(object sender, EventArgs e)
        {
            double auxPesos;

            if (!double.TryParse(txtCotizacionPeso.Text, out auxPesos) || auxPesos < 0)
            {
                txtCotizacionPeso.Focus();
            }
            else
            {
                Pesos.SetCotizacion(auxPesos);
            }
        }
예제 #26
0
        private void TxtCotiPeso_Leave(object sender, EventArgs e)
        {
            double coti;

            if (Double.TryParse(txtCotiPeso.Text, out coti))
            {
                Pesos.SetCotizacion(coti);
            }
            else
            {
                txtCotiPeso.Focus();
            }
        }
예제 #27
0
        private void txtCotizacionPeso_OnLeave(object sender, EventArgs e)
        {
            double aux;

            if (Double.TryParse(this.txtCotizacionPeso.Text, out aux))
            {
                Pesos.SetCotizacion(aux);
            }
            else
            {
                this.txtCotizacionEuro.Focus();
            }
        }
예제 #28
0
        private void txtPeso_Leave(object sender, EventArgs e)
        {
            double auxPesos;

            if (!double.TryParse(txtPeso.Text, out auxPesos) || auxPesos < 0)
            {
                txtPeso.Focus();
            }
            else
            {
                pesos = auxPesos;
            }
        }
        private void txtBCotizPeso_Leave(object sender, EventArgs e)
        {
            double n;
            bool   isNumeric = double.TryParse(txtBCotizPeso.Text, out n);

            if (isNumeric)
            {
                Pesos.SetCotizacion(n);
            }
            else
            {
                txtBCotizPeso.Select();
            }
        }
예제 #30
0
        static void Main(string[] args)
        {
            Euro  e = new Euro(10, 1.16);
            Dolar d = new Dolar(10);
            Pesos p = new Pesos(10, 38.33);

            Euro auxe = e + d;

            Console.WriteLine("Euro + Dolar  : {0:#.00}", auxe.GetCantidad());
            auxe = e + p;
            Console.WriteLine("Euro + Pesos : {0:#.00}", auxe.GetCantidad());

            Console.ReadKey();
        }