Exemple #1
0
        static void Main(string[] args)
        {
            Fahrenheit unF = new Fahrenheit(1);
            Celsius    unC = new Celsius(-17.22);
            Kelvin     unK = new Kelvin(255.92);



            /*
             * Console.WriteLine(((Kelvin)unF).GetCantidad());
             * Console.WriteLine(((Celsius)unF).GetCantidad());
             * Console.WriteLine(unF.GetCantidad());
             * Console.ReadKey();
             *
             * Console.WriteLine(((Kelvin)unC).GetCantidad());
             * Console.WriteLine(((Fahrenheit)unC).GetCantidad());
             * Console.WriteLine(unC.GetCantidad());
             * Console.ReadKey();
             *
             *
             * Console.WriteLine(((Celsius)unK).GetCantidad());
             * Console.WriteLine(((Fahrenheit)unK).GetCantidad());
             * Console.WriteLine(unK.GetCantidad());*/


            Console.WriteLine(unK == unF);
            // Console.WriteLine(unC.GetCantidad());
            // Console.WriteLine(unK.GetCantidad());
            // Console.WriteLine(((Kelvin)unC).GetCantidad());
            // Console.WriteLine(((Celsius)unK).GetCantidad());
            Console.ReadKey();
        }
Exemple #2
0
        public static Celsius operator -(Celsius c, Farenheit f)
        {
            Celsius cel = new Celsius(0);

            cel            = (Celsius)f;
            cel._cantidad -= c.getCantidad();
            return(c);
        }
Exemple #3
0
        public static Celsius operator -(Celsius c, Kelvin k)
        {
            Celsius cel = new Celsius(0);

            cel            = (Celsius)k;
            cel._cantidad -= c.getCantidad();
            return(cel);
        }
        public static bool operator ==(Kelvin k, Celsius c)
        {
            Celsius cel = new Celsius(0);

            cel = (Celsius)k;
            float aux = (float)cel.getCantidad();

            return(aux == (float)c.getCantidad());
        }
Exemple #5
0
        static void Main(string[] args)
        {
            Celsius gradosPrueba = new Celsius(22);

            Fahrenheit pruebaConversion = (Fahrenheit)gradosPrueba;

            Console.WriteLine("ASDASD: {0}", pruebaConversion.GetCantidadGrados());

            Console.ReadKey();
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Fahrenheit f = new Fahrenheit(100);
            Celsius    c = (Celsius)f;
            Kelvin     k = (Kelvin)f;

            Console.WriteLine(((Fahrenheit)k).GetTemp());
            Console.WriteLine();
            Console.ReadKey();
        }
Exemple #7
0
        static void Main(string[] args)
        {
            //Celsius
            Console.WriteLine("Declaro Celsius de 30º");
            Celsius c30 = new Celsius(30);

            Console.WriteLine("Celsius To Fahreinheit: " + c30.GetCelsiusToFahrenheit());


            Console.ReadKey();
        }
Exemple #8
0
        public static bool operator ==(Celsius c, Farenheit f)
        {
            Celsius cel = new Celsius(0);

            cel = (Celsius)f;
            if (c.getCantidad() == (float)cel.getCantidad())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #9
0
        static void Main(string[] args)
        {
            Celsius   c1 = new Celsius(1d);
            Kelvin    k  = new Kelvin(1);
            Farenheit f1 = new Farenheit(1);
            Celsius   c2 = new Celsius(1);

            /*c1 = (Celsius) k;
             * f1 = (Farenheit) c1;*/
            //c1 = (Celsius)k;
            f1 += k;
            Console.WriteLine(f1.getCantidad());
            f1 += k;
            Console.WriteLine(f1.getCantidad());
            Console.ReadLine();
        }
Exemple #10
0
        static void Main(string[] args)
        {
            Kelvin     kel  = new Kelvin(255.928);
            Celsius    cel  = new Celsius(-17.2222);
            Fahrenheit fahr = new Fahrenheit(1);


            if (fahr == kel)
            {
                Console.WriteLine("Entro");
            }
            else
            {
                Console.WriteLine("No entro");
            }

            Console.ReadKey();
        }
        public static Celsius operator -(Celsius c, Kelvin k)
        {
            Celsius cel = new Celsius(c.GetCantidad() - ((Celsius)k).GetCantidad());

            return(cel);
        }
        public static Celsius operator -(Celsius c, Fahrenheit f)
        {
            Celsius cel = new Celsius(c.GetCantidad() - ((Celsius)f).GetCantidad());

            return(cel);
        }
        static void Main(string[] args)
        {
            Celsius    c = new Celsius(30);
            Fahrenheit f = new Fahrenheit(85);
            Kelvin     k = new Kelvin(274);

            Celsius    nuevoC = 32;
            Fahrenheit nuevoF = 96;
            Kelvin     nuevoK = 55;

            Console.WriteLine("CONVERSION IMPLICITA: Celsius: {0} Fahrenheit: {1} Kelvin: {2}\n", nuevoC.GetCantidad(), nuevoF.GetCantidad(), nuevoK.GetCantidad());

            Kelvin     nuevoKExp  = (Kelvin)f;
            Fahrenheit nuevoFExp  = (Fahrenheit)k;
            Celsius    nuevoCExp  = (Celsius)f;
            Kelvin     nuevoK2Exp = (Kelvin)c;
            Fahrenheit nuevoF2Exp = (Fahrenheit)c;
            Celsius    nuevoC2Exp = (Celsius)k;

            Console.WriteLine("CONVERSION EXPLICITA: \n");
            Console.WriteLine($"{c.GetCantidad()} grados Fahrenheit a Kelvin: {nuevoKExp.GetCantidad().ToString("0.##")}\n");
            Console.WriteLine($"{f.GetCantidad()} grados Fahrenheit a Celsius: {nuevoCExp.GetCantidad().ToString("0.##")}\n");
            Console.WriteLine($"{c.GetCantidad()} grados Celsius a Kelvin: {nuevoK2Exp.GetCantidad().ToString("0.##")}\n");
            Console.WriteLine($"{c.GetCantidad()} grados Celsius a Fahrenheit: {nuevoF2Exp.GetCantidad().ToString("0.##")}\n");
            Console.WriteLine($"{k.GetCantidad()} grados Kelvin a Fahrenheit: {nuevoFExp.GetCantidad().ToString("0.##")}\n");
            Console.WriteLine($"{k.GetCantidad()} grados Kelvin a Celsius: {nuevoC2Exp.GetCantidad().ToString("0.##")}\n");

            Console.WriteLine("----------------------------------------------");

            Fahrenheit aux_f = f + c;

            Console.WriteLine("Fahrenheit + Celsius: {0}", aux_f.GetCantidad().ToString("0.##"));
            aux_f = f + k;
            Console.WriteLine("Fahrenheit + Kelvin: {0}", aux_f.GetCantidad().ToString("0.##"));
            Console.WriteLine("----------------------------------------------");

            Celsius aux_c = c + f;

            Console.WriteLine("Celsius + Fahrenheit: {0}", aux_c.GetCantidad().ToString("0.##"));
            aux_c = c + k;
            Console.WriteLine("Celsius + Kelvin: {0}", aux_c.GetCantidad().ToString("0.##"));
            Console.WriteLine("----------------------------------------------");

            Kelvin aux_k = k + c;

            Console.WriteLine("Kelvin + Celsius: {0}", aux_k.GetCantidad().ToString("0.##"));
            aux_k = k + f;
            Console.WriteLine("Kelvin + Fahrenheit: {0}", aux_k.GetCantidad().ToString("0.##"));

            Console.WriteLine("----------------------------------------------");

            aux_f = f - c;
            Console.WriteLine("Fahrenheit - Celsius: {0}", aux_f.GetCantidad().ToString("0.##"));
            aux_f = f - k;
            Console.WriteLine("Fahrenheit - Kelvin: {0}", aux_f.GetCantidad().ToString("0.##"));
            Console.WriteLine("----------------------------------------------");

            aux_c = c - f;
            Console.WriteLine("Celsius - Fahrenheit: {0}", aux_c.GetCantidad().ToString("0.##"));
            aux_c = c - k;
            Console.WriteLine("Celsius - Kelvin: {0}", aux_c.GetCantidad().ToString("0.##"));
            Console.WriteLine("----------------------------------------------");

            aux_k = k - c;
            Console.WriteLine("Kelvin - Celsius: {0}", aux_k.GetCantidad().ToString("0.##"));
            aux_k = k - f;
            Console.WriteLine("Kelvin - Fahrenheit: {0}", aux_k.GetCantidad().ToString("0.##"));

            Console.ReadKey();
        }