コード例 #1
0
        static void Main(string[] args)


        {
            string userOption = null;

            do
            {
                Console.WriteLine("What conversion would you like to perform? FtoC or CtoF?");
                userOption = Console.ReadLine().ToLower();
                if (userOption == "ftoc")
                {
                }

                Console.WriteLine("What is the temperature in Fahrenheit you want to convert to Celsius?");
                double fahTemp = Convert.ToDouble(Console.ReadLine());

                double convertToCel = TempConverter.FahrenheitToCelsius(fahTemp);

                Console.WriteLine($"{fahTemp} is {convertToCel} degrees Celsius");

                Console.WriteLine();
                Console.WriteLine($"{fahTemp} is {convertToCel} degrees Celsius");
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var conversion = new TempConverter();

            Console.WriteLine(conversion.FahrenheitToCelsius(32));
            Console.WriteLine(conversion.CelsiusToFahrenheit(0));
        }
コード例 #3
0
        static void Main(string[] args)
        {
            var celcius    = TempConverter.FahrenheitToCelsius(68);
            var fahrenheit = TempConverter.CelsiusToFahrenheit(20);

            Console.WriteLine($"Celcius: {celcius}");
            Console.WriteLine($"Fahrenheit: {fahrenheit}");
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: dmstringer/StaticExercise
        static void Main(string[] args)
        {
            var celsius    = TempConverter.FahrenheitToCelsius(50);
            var fahrenheit = TempConverter.CelsiusToFahrenheit(30);

            Console.WriteLine($"50 degrees Fahrenheit is {celsius} Celcius.");    // should be 10
            Console.WriteLine($"30 degrees Celcius is {fahrenheit} Fahrenheit."); // should be 86
        }
コード例 #5
0
        static void Main(string[] args)
        {
            var celsius    = TempConverter.FahrenheitToCelsius(25);
            var fahrenheit = TempConverter.CelsiusToFahrenheit(25);


            Console.WriteLine($"C = {celsius}, F = {fahrenheit}");
        }
コード例 #6
0
        static void Main(string[] args)
        {
            Console.WriteLine(TempConverter.FahrenheitToCelsius(32));
            Console.WriteLine(TempConverter.CelsiusToFahrenheit(0));

            Console.WriteLine(TempConverter.FahrenheitToCelsius(212));
            Console.WriteLine(TempConverter.CelsiusToFahrenheit(100));
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: moorejbm/StaticExercise
        static void Main(string[] args)
        {
            var celius    = TempConverter.FahrenheitToCelsius(161.6);
            var fahenheit = TempConverter.CelsiusToFahrenheit(72);

            Console.WriteLine($"celcius {celius}");
            Console.WriteLine($"Fahrenheit {fahenheit}");
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: dalykb34/StaticExercise
        static void Main(string[] args)
        {
            var celsius = TempConverter.FahrenheitToCelsius(72);

            Console.WriteLine($"{celsius} degrees");
            var fahrenheit = TempConverter.CelsiusToFahrenheit(32);

            Console.WriteLine($"{fahrenheit} Degrees");
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: remi0007/StaticExercise
        static void Main(string[] args)
        {
            var celcius    = TempConverter.FahrenheitToCelsius(68); // 20
            var fahrenheit = TempConverter.CelsiusToFahrenheit(29); // 68

            Console.WriteLine("After conversion:");
            Console.WriteLine($" celcius {celcius}");
            Console.WriteLine($"fahrenheit {fahrenheit}");
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: Eber27/Static_Exercise
        static void Main(string[] args)
        {
            var Celsius = TempConverter.FahrenheitToCelsius(25);

            Console.WriteLine($"This is {Celsius} degrees celsius.");

            var Fahrenheit = TempConverter.CelsiusToFahrenheit(40);

            Console.WriteLine($"This is {Fahrenheit} degrees fahrenheit");
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: Allyogi84/StaticExercise
        static void Main(string[] args)
        {
            var celcius    = TempConverter.FahrenheitToCelsius(68); //20
            var fahrenheit = TempConverter.CelciusToFahrenheit(20); //68

            //Console = Class, WriteLine = method in a class, which is a static method
            Console.WriteLine("After conversion:");
            Console.WriteLine($"celcius {celcius}");
            Console.WriteLine($"fahrenheit {fahrenheit}");
        }
コード例 #12
0
        static void Main(string[] args)
        {
            Console.WriteLine("After Conversion:");
            var f = TempConverter.CelsiusToFahrenheit(28);
            var c = TempConverter.FahrenheitToCelsius(68);


            Console.WriteLine($"28 degrees in Celsius is {f} degrees in Farenheit.");
            Console.WriteLine($"68 degrees in Fahrenheit is {c} degrees in Celsius.");
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: brads83/StaticExercise
        static void Main(string[] args)
        {
            //Console.WriteLine("Please enter a temperature to convert to Fahrenheit");
            //Console.ReadLine() =

            Console.WriteLine($"Temp is {TempConverter.CelsiusToFahrenheit(45)}");

            //Console.WriteLine("Please enter a temperature to convert to Celsius");
            //Console.ReadLine() =
            Console.WriteLine($"Celsius temp is {TempConverter.FahrenheitToCelsius(45)}");
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: RMhoon/StaticExercise
        static void Main(string[] args)
        {
            Console.WriteLine("Enter Celsius to convert");
            var cel = double.Parse(Console.ReadLine());

            Console.WriteLine($"C {cel} is F:{TempConverter.CelsiusToFahrenheit(cel):#,###.#}");

            Console.WriteLine("Enter Fahrenheit to convert");
            var fahren = double.Parse(Console.ReadLine());

            Console.WriteLine($"F {fahren}  is C:{TempConverter.FahrenheitToCelsius(fahren):#,###.#}");
        }
コード例 #15
0
        static void Main(string[] args)
        {
            Console.Write("Please specify a Fahrenheit temp to convert to Celsius: ");
            var cel = TempConverter.FahrenheitToCelsius(Convert.ToDouble(Console.ReadLine()));

            Console.WriteLine($"The Celsius temp would be {cel}");
            Console.WriteLine();
            Console.Write("Please specify a Celsius temp to convert to Fahrenheit: ");
            var fahr = TempConverter.CelsiusToFahrenheit(Convert.ToDouble(Console.ReadLine()));

            Console.WriteLine($"The Fahrenheit temp would be {fahr}");
        }
コード例 #16
0
ファイル: Program.cs プロジェクト: JustusStorm/StaticExercise
        static void Main(string[] args)
        {
            var temp = 100;

            var fTemp = TempConverter.CelsiusToFahrenheit(temp);

            Console.WriteLine(fTemp);

            var cTemp = TempConverter.FahrenheitToCelsius(fTemp);

            Console.WriteLine(cTemp);

            Console.ReadLine();
        }
コード例 #17
0
        static void Main(string[] args)
        {
            Console.WriteLine();
            Console.WriteLine("After Conversion:");
            Console.WriteLine("-----------------------------");
            var celsius = TempConverter.FahrenheitToCelsius(86);

            Console.WriteLine($" {celsius} Celsius.");


            var fahrenheit = TempConverter.CelsiusToFahrenheit(34);

            Console.WriteLine($" {fahrenheit} Fahrenheit.");
        }
コード例 #18
0
        static void Main(string[] args)
        {
            Console.WriteLine($"What is your Temperature in Celsius?");
            double celsiusInput = double.Parse(Console.ReadLine());

            TempConverter.CelsiusToFarenheit(celsiusInput);
            Console.WriteLine($"Your temperature is {TempConverter.CelsiusToFarenheit(celsiusInput)} degrees Farenheit");

            Console.WriteLine($"What is your Temperature in Farenheit?");
            double farenheitInput = double.Parse(Console.ReadLine());

            TempConverter.FarenheitToCelsius(farenheitInput);
            Console.WriteLine($"Your temperature is {TempConverter.FarenheitToCelsius(farenheitInput)} degrees Celsius");
        }
コード例 #19
0
        static void Main(string[] args)
        {
            Console.WriteLine("What is the temperature in F you want to convert?");
            double fahTemp      = Convert.ToDouble(Console.ReadLine());
            double convertToCel = Convert.ToDouble(TempConverter.FahrenheitToCelsius(fahTemp));


            Console.WriteLine($"That equals {convertToCel} degrees Celsius");
            Console.WriteLine();

            Console.WriteLine("What is the temperature in Celsius you want to convert?");
            double celTemp      = Convert.ToDouble(Console.ReadLine());
            double convertToFah = Convert.ToDouble(TempConverter.CelsisuToFahrenheit(celTemp));

            Console.WriteLine($"That equals {convertToFah} degrees Fahrenheit");
            Console.WriteLine();
        }
コード例 #20
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Human! I am the Tempreture Conversion System or TCS.\n If you would like to convert Farenheit to Celsius, type in f,\n if you would wish to convert Celsius to farenheit, type in c.");
            string userinput = Console.ReadLine().ToLower();

            Console.WriteLine("And the value You would like to convert?");
            string value          = Console.ReadLine();
            double convertedvalue = Double.Parse(value);

            if (userinput == "f")
            {
                TempConverter.FahrenheittoCelcius(convertedvalue);
            }

            if (userinput == "c")
            {
                TempConverter.CelciustoFahrenheit(convertedvalue);
            }
        }
コード例 #21
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello user. Welcome to my Temp Converter application.");
            Console.WriteLine("Please enter a temp in Fahrenheit to convert into Celsius.");

            double f = double.Parse(Console.ReadLine());

            Console.WriteLine($"You temp in Celsius is : {TempConverter.FahrenheitToCelsius(f)}.");


            Console.WriteLine("Now, please enter a temp in Celsius to convert into Fahrenheit. ");


            double c = double.Parse(Console.ReadLine());

            Console.WriteLine($"Your temp in Fahrenheit is : {TempConverter.CelsiusToFahrenheit(c)}.");


            Console.WriteLine($"We have your tmeps as {TempConverter.FahrenheitToCelsius(f)} for the first and {TempConverter.CelsiusToFahrenheit(c)} for the second.\n End program.");
        }
コード例 #22
0
        static void Main(string[] args)
        {
            Console.WriteLine("Please give me the temp you wish to convert from Fahrenheit to Celsius.");
            double numOne = double.Parse(Console.ReadLine());

            double cel = TempConverter.FahrenheitToCelsius(numOne);

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine($"Celsius :  {cel, 0:N2}");
            Console.ResetColor();

            Console.WriteLine("Please give me a temp you wish to convert from Celsius to Fahrenheit");
            double numTwo = double.Parse(Console.ReadLine());


            double fahrenheit = TempConverter.CelsiusToFahren(numTwo);

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine($"Fahrenheit : {fahrenheit,0:N2}");
            Console.ResetColor();
        }
コード例 #23
0
        static void Main(string[] args)
        {
            Console.WriteLine("Temperature Conversions");
            Console.WriteLine();

            var num1 = 0.0;
            var num2 = 32.0;
            var num3 = 100.0;
            var num4 = 212.0;

            var result1 = TempConverter.FahrenheitToCelsius(num4);
            var result2 = TempConverter.FahrenheitToCelsius(num2);
            var result3 = TempConverter.CelsiusToFahrenheit(num1);
            var result4 = TempConverter.CelsiusToFahrenheit(num3);

            Console.WriteLine("Critical test data points - coming and going");
            Console.Write("Boiling Point: ");
            Console.WriteLine($"{num4}F = {result1}C");
            Console.Write("Freezing Point: ");
            Console.WriteLine($"{num2}F = {result2}C");
            Console.Write("Freezing Point: ");
            Console.WriteLine($"{num1}C = {result3}F");
            Console.Write("Boiling Point: ");
            Console.WriteLine($"{num3}C = {result4}F");

            Console.Write("Enter a number in Fahrenheit to be converted to Celsius: ");
            var fNum  = Convert.ToDouble(Console.ReadLine());
            var fCalc = TempConverter.FahrenheitToCelsius(fNum);

            Console.WriteLine($"{fCalc} degrees Celsius");
            Console.WriteLine();

            Console.Write("Enter a number in Celsius to be converted to Fahrenheit: ");
            var cNum  = Convert.ToDouble(Console.ReadLine());
            var cCalc = TempConverter.CelsiusToFahrenheit(cNum);

            Console.WriteLine($"{cCalc} degrees Celsius");
            Console.WriteLine();
        }
コード例 #24
0
ファイル: Program.cs プロジェクト: ZodyT/StaticExercise
        static void Main(string[] args)
        {
            Console.WriteLine("Is your temperature in C or F?");
            string temp = Console.ReadLine().ToLower();

            if (temp == "c")
            {
                Console.WriteLine("What is your Celsius temperature?");
                double C = Convert.ToDouble(Console.ReadLine());

                var CFinal = TempConverter.CelsiusToFahrenheit(C);
                Console.WriteLine($"Your tempature is {CFinal} in Fahrenheit.");
            }
            else if (temp == "f")
            {
                Console.WriteLine("What is your Fahrenheit temperature?");
                double F = Convert.ToDouble(Console.ReadLine());

                var FFinal = TempConverter.FahrenheitToCelsius(F);
                Console.WriteLine($"Your tempature is {FFinal} in Celsius.");
            }
        }
コード例 #25
0
 static void Main(string[] args)
 {
     TempConverter.FahrenheitToCelsius(200);
     Console.WriteLine();
     TempConverter.CelsiusToFahrenheit(150);
 }
コード例 #26
0
ファイル: Program.cs プロジェクト: Gashaye/StaticExercise
        static void Main(string[] args)
        {
            Console.WriteLine($"10 Fahrenheit = {TempConverter.FahrenheitToCelsius(10)} celcius");

            Console.WriteLine($"50 Celcius = {TempConverter.CelsiusToFahrenheit(50)} Fahrenheit");
        }
コード例 #27
0
        static void Main(string[] args)
        {
            TempConverter.FahrenheitToCelsius(80);

            TempConverter.CelsiusToFahrenheit(20);
        }
コード例 #28
0
 static void Main(string[] args)
 {
     Console.WriteLine("32 F is " + TempConverter.FahrenheitToCelsius(32) + " C");
     Console.WriteLine("100 C is " + TempConverter.CelsiusToFahrenheit(100) + " F");
 }