Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Celsius    celsius    = new Celsius(10);
            Kelvin     kelvin     = new Kelvin(298);
            Fahrenheit fahrenheit = new Fahrenheit(77);

            Console.WriteLine("***** Resultados en Celsius *****");
            Celsius cAux = (Celsius)fahrenheit;

            Console.WriteLine("{0} Fahrenheit son {1} Celsius: ", fahrenheit.GetTemperatura(), cAux.GetTemperatura());
            cAux = (Celsius)kelvin;
            Console.WriteLine("{0} Kelvin son {1} Celsius: ", kelvin.GetTemperatura(), cAux.GetTemperatura());

            Console.WriteLine("\n***** Resultados en Kelvin *****");
            Kelvin kAux = (Kelvin)fahrenheit;

            Console.WriteLine("{0} Fahrenheit son {1} Kelvin: ", fahrenheit.GetTemperatura(), kAux.GetTemperatura());
            kAux = (Kelvin)celsius;
            Console.WriteLine("{0} Celsius son {1} Kelvin: ", celsius.GetTemperatura(), kAux.GetTemperatura());

            Console.WriteLine("\n***** Resultados en Fahrenheit *****");
            Fahrenheit fAux = (Fahrenheit)kelvin;

            Console.WriteLine("{0} Kelvin son {1} Fahrenheit: ", kelvin.GetTemperatura(), fAux.GetTemperatura());
            fAux = (Fahrenheit)celsius;
            Console.WriteLine("{0} Celsius son {1} Fahrenheit: ", celsius.GetTemperatura(), fAux.GetTemperatura());

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Celsius    c = 10;
            Kelvin     k = (Kelvin)c;
            Fahrenheit f = (Fahrenheit)c;

            Fahrenheit f2 = 90;
            Celsius    c2 = (Celsius)f2;
            Kelvin     k2 = (Kelvin)f2;

            Kelvin     k3 = 400;
            Celsius    c3 = (Celsius)k3;
            Fahrenheit f3 = (Fahrenheit)k3;

            Console.WriteLine("---------------------------------------------------------------------------------");
            Console.WriteLine("---------------------------------------------------------------------------------");
            Console.WriteLine($"{c.GetTemperatura()} Celsius a Kelvin: {k.GetTemperatura()}");
            Console.WriteLine($"{c.GetTemperatura()} Celsius a Fahrenheit: {f.GetTemperatura()}");
            Console.WriteLine("---------------------------------------------------------------------------------");
            Console.WriteLine("---------------------------------------------------------------------------------");
            Console.WriteLine($"{k3.GetTemperatura()} Kelvin a Celsius: {c3.GetTemperatura()}");
            Console.WriteLine($"{k3.GetTemperatura()} Kelvin a Fahrenheit: {f3.GetTemperatura()}");
            Console.WriteLine("---------------------------------------------------------------------------------");
            Console.WriteLine("---------------------------------------------------------------------------------");
            Console.WriteLine($"{f2.GetTemperatura()} Fahrenheit a Kelvin: {k2.GetTemperatura()}");
            Console.WriteLine($"{f2.GetTemperatura()} Fahrenheit a Celsius: {c2.GetTemperatura()}");
            Console.WriteLine("---------------------------------------------------------------------------------");
            Console.WriteLine("---------------------------------------------------------------------------------");
            Console.ReadKey(true);
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            Fahrenheit grados1 = 70;
            Kelvin     grados2 = -550;
            Celsius    grados3 = 100;

            Console.Title = "Ejercicio 21";
            Console.WriteLine((grados1 + grados2).GetGrados());
            Console.ReadLine();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            /*Fahrenheit f = 98.6;
             * Console.WriteLine("{0}", ((Celsius) f).GetCantidad()); prueba truchita*/
            Celsius    tC = 25;
            Fahrenheit tF = 32;                                //0 ceslius
            Kelvin     tK = 273.15;                            //0 celsius

            Console.WriteLine("{0}", (tC + tK).GetCantidad()); //ok
            Console.WriteLine("{0}", (tF - tC).GetCantidad()); //revisar, no se si da bien ¿?¿?

            Console.ReadKey();
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Celsius    tempC = new Celsius(10);
            Fahrenheit tempF = new Fahrenheit(50);
            Kelvin     tempK = new Kelvin(283.15);

            Console.WriteLine($"Celsius a Fahrenheit: {((Fahrenheit)tempC).GetTempatura()}");
            Console.WriteLine($"Celsius a Kelvin: {((Kelvin)tempC).GetTempatura()}");
            Console.WriteLine($"Kelvin a Fahrenheit: {((Fahrenheit)tempK).GetTempatura()}");
            Console.WriteLine($"Kelvin a Celsius: {((Celsius)tempK).GetTempatura()}");
            Console.WriteLine($"Fahrenheit a Celsius: {((Celsius)tempF).GetTempatura()}");
            Console.WriteLine($"Fahrenheit a Kelvin: {((Kelvin)tempF).GetTempatura()}");
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            Celsius    tC = 25;
            Fahrenheit tF = 32;
            Kelvin     tK = 273.15;

            Console.WriteLine("Temperaturas de cada termómetro:");
            Console.WriteLine("Term. 1: {0}ºC  Term.2: {1}ºF Term.3: {2}ºK", tC.GetCantidad(), tF.GetCantidad(), tK.GetCantidad());
            Console.WriteLine("Term. 1: {0}ºC, {1}ºF y {2}ºK", tC.GetCantidad(), ((Fahrenheit)tC).GetCantidad(), ((Kelvin)tC).GetCantidad());
            Console.WriteLine("Term. 2: {0}ºF, {1}ºC y {2}ºK", tF.GetCantidad(), ((Celsius)tF).GetCantidad(), ((Kelvin)tF).GetCantidad());
            Console.WriteLine("Term. 3: {0}ºK, {1}ºF y {2}ºC", tK.GetCantidad(), ((Fahrenheit)tK).GetCantidad(), ((Celsius)tK).GetCantidad());

            Console.WriteLine("Term. 1: {0}ºC + Term. 2: {1}ºF = {2}ºC", tC.GetCantidad(), tF.GetCantidad(), (tC + tF).GetCantidad());
            Console.WriteLine("Term. 1: {0}ºC + Term. 3: {1}ºK = {2}ºC", tC.GetCantidad(), tK.GetCantidad(), (tC + tK).GetCantidad());

            Console.ReadKey();
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Kelvin     kelvin     = new Kelvin(50);
            Celsius    celsius    = new Celsius(60);
            Fahrenheit fahrenheit = new Fahrenheit(2000);

            Console.WriteLine("CALCULAR CAMBIO DE TEMPERATURAS ");
            Console.WriteLine("Fahrenheit a Celsius: " + ((Celsius)fahrenheit).GetTemperatura() + " ~~ Kelvin a Celsius: " + ((Celsius)kelvin).GetTemperatura());
            Console.WriteLine("Celsius a Kelvin: " + ((Kelvin)celsius).GetTemperatura() + " ~~ Fahrenheit a Kelvin: " + ((Kelvin)fahrenheit).GetTemperatura());
            Console.WriteLine("Kelvin a Fahrenheit: " + ((Fahrenheit)kelvin).GetTemperatura() + " ~~ Celcius a Fahrenheit: " + ((Fahrenheit)celsius).GetTemperatura());

            Console.WriteLine("\n SUMA ENTRE TEMPERATURAS");
            Console.WriteLine("La suma entre :{0} Fahrenheit y {1}  ", fahrenheit.GetTemperatura(), ((Fahrenheit)kelvin).GetTemperatura() + " Kelvin, en Fahrenheit es de: " + (fahrenheit + kelvin).GetTemperatura());
            Console.WriteLine("La suma entre :{0} Celsius y {1}  ", celsius.GetTemperatura(), ((Celsius)kelvin).GetTemperatura() + " kelvin, en Celsius es de: " + (celsius + kelvin).GetTemperatura());
            Console.WriteLine("La Resta entre :{0} Fahrenheit y {1}  ", fahrenheit.GetTemperatura(), ((Fahrenheit)celsius).GetTemperatura() + " Celsius, en Fahrenheit es de: " + (fahrenheit - celsius).GetTemperatura());
            Console.WriteLine("La Resta entre :{0} Kelvin y {1}  ", ((Kelvin)kelvin).GetTemperatura(), ((Kelvin)celsius).GetTemperatura() + " Celsius, en Kelvin es de: " + (kelvin - celsius).GetTemperatura());

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Console.Title = "Ejercicio 21";

            Fahrenheit f = new Fahrenheit(93.2);
            Celsius    c = new Celsius(34);
            Kelvin     k = new Kelvin(307.15);

            Console.WriteLine("1 grado Celsius equivale a {0} grados Fahrenheit\n1 grado Kelvin equivale a {1} grados Fahrenheit", Celsius.GetTemperatura(), Kelvin.GetTemperatura());

            Console.WriteLine("Cantidad de grados Fahrenheit: {0}\nCantidad de grados Celsius: {1}\nCantidad de grados Kelvin: {2}", f.GetGrados(), c.GetGrados(), k.GetGrados());

            //Console.WriteLine("Total en Fahrenheit: {0}", ((f+c)+k).GetGrados());
            //Console.WriteLine("Total Celsius: {0}", ((c+f)+k).GetGrados());
            //Console.WriteLine("Total en kelvin: {0}",((k+c)+f).GetGrados());

            Console.WriteLine("{0} Fahrenheit son {1} Celsius", f.GetGrados(), ((Celsius)f).GetGrados());
            Console.WriteLine("{0} Kelvin son {1} Celsius", k.GetGrados(), ((Celsius)k).GetGrados());

            Console.WriteLine("Total Celsius: {0}", ((c + f) + k).GetGrados());


            Console.ReadKey();
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            Console.Title = "Exercise 21°";

            Kelvin     kTemperature = new Kelvin(298.15);
            Celsius    cTemperature = new Celsius(25);
            Fahrenheit fTemperature = new Fahrenheit(77);

            Celsius cTemperature2 = new Celsius(25);


            Kelvin     kNew = new Kelvin();
            Celsius    cNew = new Celsius();
            Fahrenheit fNew = new Fahrenheit();

            Console.WriteLine("########## Temperature Convertions ##########");
            /*Fahrenheite -> Kelvin*/
            kNew = (Kelvin)fTemperature;
            double kNewDouble = kNew.GetAmount();

            Console.WriteLine($"Fahrenheit: {fTemperature.GetAmount()}° - Kelvin: {Math.Round(kNewDouble, 2)}°");

            /*Fahrenheite -> Celsius*/
            cNew = (Celsius)fTemperature;
            double cNewDouble = cNew.GetAmount();

            Console.WriteLine($"Fahrenheit: {fTemperature.GetAmount()}° - Celsius: {cNewDouble}°\n");

            /*Celsius -> Kelvin*/
            kNew       = (Kelvin)cTemperature;
            kNewDouble = kNew.GetAmount();
            Console.WriteLine($"Celsius: {cTemperature.GetAmount()}° - Kelvin: {kNewDouble}°");

            /*Celsius -> Fahrenheite*/
            fNew = (Fahrenheit)cTemperature;
            double fNewDouble = fNew.GetAmount();

            Console.WriteLine($"Celsius: {cTemperature.GetAmount()}° - Fahrenheit: {fNewDouble}°\n");

            /*Kelvin -> Celsius*/
            cNew       = (Celsius)kTemperature;
            cNewDouble = cNew.GetAmount();
            Console.WriteLine($"Kelvin: {kTemperature.GetAmount()}° - Celsius: {cNewDouble}°");

            /*Kelvin -> Fahrenheit*/
            fNew       = (Fahrenheit)kTemperature;
            fNewDouble = fNew.GetAmount();
            Console.WriteLine($"Kelvin: {kTemperature.GetAmount()}° - Fahrenheit: {Math.Round(fNewDouble,2)}°\n");

            Console.WriteLine("########## Temperature Equality ##########");
            /*Equally: Celsius -> Fahrenheit*/
            Console.WriteLine($"Celsius: {cTemperature.GetAmount()}° - Fahrenheit: {fTemperature.GetAmount()}° -> Equally: {cTemperature == fTemperature}");
            /*Equally: Celsius -> Kelvin*/
            Console.WriteLine($"Celsius: {cTemperature.GetAmount()}° - Kelvin: {kTemperature.GetAmount()}° -> Equally: {cTemperature == kTemperature}");
            /*Equally: Celsius -> Celsius*/
            Console.WriteLine($"Celsius: {cTemperature.GetAmount()}° - Celsius: {cTemperature2.GetAmount()}° -> Equally: {cTemperature == cTemperature2}\n");

            Console.WriteLine("########## Temperature Addition ##########");
            Celsius sumCelsius = new Celsius();

            sumCelsius = cTemperature + fTemperature;
            Console.WriteLine($" {cTemperature.GetAmount()}°C + {fTemperature.GetAmount()}°F: {Math.Round(sumCelsius.GetAmount(), 2)}° Celsius");
            sumCelsius = cTemperature + kTemperature;
            Console.WriteLine($" {cTemperature.GetAmount()}°C + {kTemperature.GetAmount()}°K: {Math.Round(sumCelsius.GetAmount(), 2)}° Celsius");

            Console.ReadKey(true);
        }
Ejemplo n.º 10
0
        public static Celsius operator -(Celsius celsius, Fahrenheit fahrenheit)
        {
            Celsius aux = new Celsius(celsius.GetTemperatura() - ((Celsius)fahrenheit).GetTemperatura());

            return(aux);
        }
Ejemplo n.º 11
0
        public static Celsius operator -(Celsius celsius, Kelvin kelvin)
        {
            Celsius aux = new Celsius(celsius.GetTemperatura() - ((Celsius)kelvin).GetTemperatura());

            return(aux);
        }