/******************************************************/ /* Introduction to Programming */ /* By Dr. ANTF */ /* www.antf.net */ /* Copyright 2015 */ /* */ /* C# 403 - Problem 2: Degrees to Fahrenheit (a) */ /******************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DOS { class Program { static float ToFahren(float x) { return ((x * 9f / 5) + 32); } static void CheckState(float temperature) { if (temperature <= 0) Console.WriteLine("\nVery Cold"); else if (temperature <= 10) Console.WriteLine("\nCold"); else if (temperature <= 20) Console.WriteLine("\nWarm"); else if (temperature <= 30) Console.WriteLine("\nHot"); else Console.WriteLine("\nVery Hot"); } static void Main(string[] args) { float degrees; Console.Write("Please entere the temperature in degrees: "); degrees = float.Parse(Console.ReadLine()); Console.WriteLine("\n{0} C ---> {1} F", degrees, ToFahren(degrees)); CheckState(degrees); Console.ReadKey(); } } }