Example #1
0
        static void Main(string[] args)
        {
            //Static Keyword Exercise #1

            Console.WriteLine("Temperature Conversion");
            //Convert Fahrenheit to Celsius
            Console.Write("Enter a Temperature in Fahrenheit to Convert to Celsius: ");
            double ftemp = TempConverter.FahrenheitToCelsius(double.Parse(Console.ReadLine()));

            Console.WriteLine($"The Celsius Temperature is {ftemp} degrees.");
            Console.WriteLine();

            //Convert Celsius to Fahrenheit
            Console.Write("Enter a Temperature in Celsius to convert to Fahrenheit: ");
            double ctemp = TempConverter.CelsiusToFahrenheit(double.Parse(Console.ReadLine()));

            Console.WriteLine($"The Fahrenheit Temperature is {ctemp} degrees.");
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the temp converter app!");

            Console.WriteLine("Enter a temp in Fahrenheit to convert: ");
            double fahrenheit = double.Parse(Console.ReadLine());

            Console.WriteLine($"The temperature in Clesius is: {TempConverter.FahrenheitToCelsius(fahrenheit)}");

            Console.WriteLine("Now enter a temp in Celsius to convert: ");
            double celsius = double.Parse(Console.ReadLine());

            Console.WriteLine($"The temperature in Fahrenheit is: {TempConverter.CelsiusToFahrenheit(celsius)}");

            Console.WriteLine("Thank you for using our app! Have a great day :)");


            //var celsius = TempConverter.FahrenheitToCelsius(68);
            //Console.WriteLine($"Celsius {celsius}");

            //var fahrenheit = TempConverter.CelsiusToFahrenheit(20);
            //Console.WriteLine($"Fahrenheit {fahrenheit}");
        }