public static Dolar operator -(Dolar d, Euro e)
        {
            var auxDolar = new Dolar(e.GetCantidad() * Euro.GetCotizacion());

            auxDolar._cantidad -= d._cantidad;
            return(auxDolar);
        }
Example #2
0
 public static bool operator ==(Dolar d, Euro e)
 {
     if (d.GetCantidad() == (e.GetCantidad() * Euro.GetCotizacion()))
     {
         return(true);
     }
     return(false);
 }
Example #3
0
 public static bool operator ==(Euro e, Pesos p)
 {
     if (e.GetCantidad() == ((p.GetCantidad() / Pesos.GetCotizacion()) / Euro.GetCotizacion()))
     {
         return(true);
     }
     return(false);
 }
Example #4
0
 public static bool operator ==(Pesos p, Euro e)
 {
     if (p.GetCantidad() == ((e.GetCantidad() * Euro.GetCotizacion()) * Pesos.GetCotizacion()))
     {
         return(true);
     }
     return(false);
 }
Example #5
0
 public static bool operator ==(Euro e, Dolar d)
 {
     if (e.GetCantidad() == (d.GetCantidad() / Euro.GetCotizacion()))
     {
         return(true);
     }
     return(false);
 }
        //Euro Peso
        public static bool operator ==(Euro euro, Peso peso)
        {
            var auxDolar = ( Dolar )peso;

            if (euro._cantidad == (auxDolar.GetCantidad() / Euro.GetCotizacion()))
            {
                return(true);
            }

            return(false);
        }
Example #7
0
 public static bool operator !=(Euro e, Dolar d)
 {
     if (d.GetCantidad() == e.GetCantidad() * Euro.GetCotizacion())
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
        //Dolar Euro
        public static bool operator ==(Dolar dollar, Euro euro)
        {
            var auxEuro = euro.GetCantidad();

            if (dollar._cantidad == (euro.GetCantidad() * Euro.GetCotizacion()))
            {
                return(true);
            }


            return(false);
        }
Example #9
0
        static void Main(string[] args)
        {
            Console.Title = "Ejercicio Nro 20";

            //Builder with one parametre
            Dolar dolar1 = new Dolar(2000);
            Euro  euro1  = new Euro(1000);
            Pesos peso1  = new Pesos(10000);

            //Builder with two parametres
            Dolar dolar2 = new Dolar(1000, 1);
            Euro  euro2  = new Euro(500, 1.16f);
            Pesos peso2  = new Pesos(5000, 38.33f);

            //Builder with one parametre
            Dolar dolar3 = new Dolar(1500);
            Euro  euro3  = new Euro(500);
            Pesos peso3  = new Pesos(2000);

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Cotizaciones del Dia Respecto al DOLAR U$D: \nEuro: ${0} Peso: ${1}",
                              euro1.GetCotizacion(), peso1.GetCotizacion());
            Console.WriteLine("Cotizaciones del Dia Respecto al DOLAR U$D: \nEuro: ${0} Peso: ${1}\n",
                              euro2.GetCotizacion(), peso2.GetCotizacion());

            //Explicit Casting
            euro1 = (Euro)dolar1;
            peso1 = (Pesos)dolar1;
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("Mi Cuenta 1: Tiene  ${0} Dolares = ${1,5:#,###.00} Euros - ${2,5:#,###.00} Pesos",
                              dolar1.GetCantidad(), euro1.GetCantidad(), peso1.GetCantidad());
            //Explicit Casting
            //dolar2 = (Dolar)peso2;
            //euro2 = (Euro)peso2;
            Console.WriteLine("Mi Cuenta 2: Tiene  ${0,5:#,###.00} Dolares = ${1,5:#,###.00} Euros - ${2,5:#,###.00} Pesos",
                              dolar2.GetCantidad(), euro2.GetCantidad(), peso2.GetCantidad());
            Console.WriteLine("Mi Cuenta 3: Tiene  ${0,5:#,###.00} Dolares = ${1,5:#,###.00} Euros - ${2,5:#,###.00} Pesos",
                              dolar3.GetCantidad(), euro3.GetCantidad(), peso3.GetCantidad());
            //OverLoad of operators
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\nEntre mis cuentas 2 y 3 tengo:\nDistintos Dolares {0} \nIgual Euros {1}\nIgual Pesos {2}",
                              (dolar2 != dolar3), (euro2 == euro3), (peso2 == peso3));


            Console.ReadKey();
        }
Example #10
0
        public static Dolar operator -(Dolar d, Euro e)
        {
            Dolar aux = new Dolar(d.GetCantidad() - (e.GetCantidad() * Euro.GetCotizacion()));

            return(aux);
        }
Example #11
0
        //Metodo estatico sobrecargado para convertir moneda a dolar.
        public static double ConvertToDolar(Euro e)
        {
            double euroToDolar = e.GetCantidad() / Euro.GetCotizacion();

            return(euroToDolar);
        }
Example #12
0
 public static Euro operator -(Euro e, Dolar d)
 {
     return(new Euro(e.cantidad - ((Euro)(d.GetCantidad() / Euro.GetCotizacion())).cantidad));
 }
Example #13
0
 public static Pesos operator +(Pesos p, Euro e)
 {
     return(new Pesos(p.cantidad + (e.GetCantidad() / Euro.GetCotizacion())));
 }
Example #14
0
        public static Pesos operator +(Pesos p, Euro e)
        {
            Pesos aux = new Pesos(p.GetCantidad() + (e.GetCantidad() * Euro.GetCotizacion() * Pesos.GetCotizacion()));

            return(aux);
        }
 public static bool operator ==(Dolar d, Euro e)
 {
     return(d.cantidad == (e.GetCantidad() * Euro.GetCotizacion()));
 }
 public static Dolar operator +(Dolar d, Euro e)
 {
     return(new Dolar(d.cantidad + (e.GetCantidad() * Euro.GetCotizacion())));
 }
Example #17
0
 public static Pesos operator -(Pesos p, Euro e)
 {
     return(new Pesos(p.GetCantidad() - (e.GetCantidad() * Euro.GetCotizacion() * Pesos.GetCotizacion())));
 }
 public static Euro operator +(Euro e, Pesos p)
 {
     return(new Euro(((e.GetCantidad() / Euro.GetCotizacion()) + (p.GetCantidad() / Pesos.GetCotizacion())) * GetCotizacion()));
 }
Example #19
0
 public static bool operator ==(Pesos p, Euro e)
 {
     return((p.GetCantidad() / GetCotizacion()) == (e.GetCantidad() * Euro.GetCotizacion()));
 }
Example #20
0
        public static Euro operator +(Euro e, Dolar d)
        {
            Euro aux = new Euro((Dolar.ConvertToDolar(e) + d.GetCantidad()) * Euro.GetCotizacion());

            return(aux);
        }
Example #21
0
        public static Euro operator +(Euro e, Pesos p)
        {
            Euro aux = new Euro((Dolar.ConvertToDolar(e) + Dolar.ConvertToDolar(p)) * Euro.GetCotizacion());

            return(aux);
        }
Example #22
0
        public static Pesos operator +(Pesos p, Euro e)
        {
            Dolar d = new Dolar(e.GetCantidad() / Euro.GetCotizacion());

            return(new Pesos(p.cantidad + ((Pesos)d).GetCantidad()));
        }