static void Main(string[] args) { Euro e = new Euro(10, 1.0937f); Dolar d = new Dolar(10); Pesos p = new Pesos(10, 64.62f); Console.WriteLine("Pesos {0}:", Pesos.GetCotizacion()); 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(); }
public static bool operator ==(Dolar d, Euro e) { if (d.GetCantidad() == (e.GetCantidad() * Euro.GetCotizacion())) { return(true); } return(false); }
public static bool operator ==(Pesos p, Euro e) { if (p.GetCantidad() == ((e.GetCantidad() * Euro.GetCotizacion()) * Pesos.GetCotizacion())) { return(true); } return(false); }
public static bool operator !=(Euro e1, Euro e2) { bool distinto = false; if (e1.GetCantidad() != e2.GetCantidad()) { distinto = true; } return(distinto); }
public static Euro operator +(Euro e, Pesos p) { Euro e1 = (Euro)p; Euro eFinal = new Euro(e.GetCantidad() + e1.GetCantidad(), GetCotizacion()); return(eFinal); }
public static Euro operator +(Euro e, Dolar d) { Euro conversionEuro = new Euro(); conversionEuro = (Euro)d; return(e.GetCantidad() + conversionEuro.GetCantidad()); }
public static Euro operator +(Euro e, Pesos p) { Euro conversionEuro = new Euro(); conversionEuro = (Euro)p; return(e.GetCantidad() + conversionEuro.GetCantidad()); }
public static Euro operator -(Euro e, Pesos p) { //Conversion de Peso a Euro Euro e1 = (Euro)p; Euro eFinal = new Euro(e.GetCantidad() - e1.GetCantidad(), GetCotizacion()); return(eFinal); }
public static bool operator ==(Euro e, Dolar d) { Euro retorno = new Euro(); retorno = (Euro)d; return((float)e.GetCantidad() == retorno.GetCantidad()); }
public static Euro operator +(Euro e, Dolar d) { //Conversion de Dolar a Euro Euro e1 = (Euro)d; Euro eFinal = new Euro(e.GetCantidad() + e1.GetCantidad(), GetCotizacion()); return(eFinal); }
public static bool operator ==(Euro e, Pesos p) { Euro retorno = new Euro(); retorno = (Euro)p; return((float)e.GetCantidad() == retorno.GetCantidad()); }
public static Euro operator -(Euro e, Pesos p) { Euro pasaje = new Euro(); pasaje = (Euro)p; pasaje = e.GetCantidad() - pasaje.GetCantidad(); return(pasaje); }
public static Euro operator -(Euro e, Dolar d) { Euro pasaje = new Euro(); pasaje = (Euro)d; pasaje = e.GetCantidad() - pasaje.GetCantidad(); return(pasaje); }
public static bool operator !=(Pesos p, Euro e) { Euro pEuro = (Euro)p; if (pEuro.GetCantidad() != e.GetCantidad()) { return(true); } return(false); }
public static bool operator !=(Dolar d, Euro e) { Euro dEuro = (Euro)d; if (dEuro.GetCantidad() != e.GetCantidad()) { return(true); } return(false); }
public static bool operator ==(Euro e, Pesos p) { bool ret = false; Euro e2 = (Euro)(p); if (e.GetCantidad() == e2.GetCantidad()) { ret = true; } return(ret); }
public static bool operator ==(Euro e, Dolar d) { Euro e1 = (Euro)d; bool returnValue = false; if (e.GetCantidad() == e1.GetCantidad()) { returnValue = true; } return(returnValue); }
public static Euro operator +(Euro e, Peso p) { Euro euro; Euro pEuro = (Euro)p; double cant = e.GetCantidad() + pEuro.GetCantidad(); euro = new Euro(cant); return(euro); }
public static Euro operator +(Euro e, Dolar d) { Euro euro; Euro dEuro = (Euro)d; double cant = e.GetCantidad() + dEuro.GetCantidad(); euro = new Euro(cant); return(euro); }
public static bool operator !=(Euro e, Pesos p) { Euro e1 = (Euro)p; bool returnValue = false; if (e.GetCantidad() != e1.GetCantidad()) { returnValue = true; } return(returnValue); }
public static bool operator ==(Peso p, Euro e) { Euro euro = (Euro)p; bool rtnVal = false; if (e.GetCantidad() == euro.GetCantidad()) { rtnVal = true; } return(rtnVal); }
static void Main(string[] args) { Euro euro1 = 20d; Dolar dolar1 = 15d; Pesos pesos1 = 50d; Console.WriteLine(euro1.GetCantidad()); Console.WriteLine(dolar1.GetCantidad()); Console.WriteLine(pesos1.GetCantidad()); Euro e = new Euro(10); Dolar d = new Dolar(10); Pesos p = new Pesos(10); d = (Dolar)e; Console.WriteLine(d.GetCantidad()); Euro aux_e = e + d; Console.WriteLine("Euro + Dólar: {0}", aux_e.GetCantidad()); aux_e = e + p; Console.WriteLine("Euro + Pesos: {0}", aux_e.GetCantidad()); Console.WriteLine("----------------------------------------------"); Dolar aux_d = d + e; Console.WriteLine("Dólar + Euro: {0}", aux_d.GetCantidad()); aux_d = d + p; Console.WriteLine("Dólar + Pesos: {0}", aux_d.GetCantidad()); Console.WriteLine("----------------------------------------------"); Pesos aux_p = p + e; Console.WriteLine("Pesos + Euro: {0}", aux_p.GetCantidad()); aux_p = p + d; Console.WriteLine("Pesos + Dólar {0}", aux_p.GetCantidad()); Console.ReadKey(); }
public static bool operator ==(Pesos p, Euro e) { Euro auxE = (Euro)p; if (auxE.GetCantidad() == e.GetCantidad()) { return(true); } else { return(false); } }
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(); }
static void Main(string[] args) { Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.Yellow; Pesos xPesosE = new Pesos(28.65D, 21F); Pesos xPesosD = new Pesos(45D, 21F); Euro xEuro = new Euro(1D, 0.7330F); Euro xEuro2 = new Euro(2D, 0.7330F); Dolar xDolar = new Dolar(2D, 1F); Dolar xDolar2 = new Dolar(2.7286D, 1F); Dolar restaD = xDolar2 - xEuro; Dolar restaE = xDolar - xPesosD; //bool xresult = xPesosE != xEuro; //xEuro = (Pesos)xEuro; //xDolar = (Pesos)xDolar; //xPesosE = (Pesos)xEuro; //xPesosD = (Pesos)xDolar; //Console.WriteLine("{0} Euros equivalen a {1} Pesos", xEuro.GetCantidad(), Math.Round(xPesosE.GetCantidad(),2)); //Console.WriteLine("{0} Dólares equivalen a {1} Pesos",xDolar.GetCantidad() ,Math.Round(xPesosD.GetCantidad(),2)); Console.WriteLine("{0} Dolares - {1} Euros es??: ${2}", xDolar2.GetCantidad(), xEuro.GetCantidad(), restaD.GetCantidad()); //1,3643 Dolares Console.WriteLine("{0} Dolares - {1} Pesos es??: ${2}", xDolar.GetCantidad(), xPesosD.GetCantidad(), restaE.GetCantidad()); //-0,14 Dolares //Console.WriteLine("{0} Dolares es Igual a {1} Dolares??: {2}", xDolar.GetCantidad(), xEuro2.GetCantidad(), xDolar == xDolar2); Console.ReadKey(); }
//Metodo estatico sobrecargado para convertir moneda a dolar. public static double ConvertToDolar(Euro e) { double euroToDolar = e.GetCantidad() / Euro.GetCotizacion(); return(euroToDolar); }
public static Euro operator +(Euro e, Dolar d) { Euro euro = new Euro(e.GetCantidad() + ((Euro)d).GetCantidad()); return(euro); }