/** * @author Duncan Buell * 16 January 2008 * * This is a simple program to take a temperature in Fahrenheit and * convert to Celsius. * * Lines in java that are inside a "slash star ... star slash" are comments. **/ public class TempConversion1 { public static void main(String[] args) { double celsius,fahrenheit; // Text in java that follows a slash slash is also a comment. // Start with 10 degrees Fahrenheit, then convert to Celsius and display it. fahrenheit = 10.0; celsius = (fahrenheit - 32.0) * 5.0 / 9.0; System.out.println("Fahrenheit " + fahrenheit + " equals " + celsius + " in Celsius"); // Now try 50 degrees Fahrenheit. fahrenheit = 50.0; celsius = (fahrenheit - 32.0) * 5.0 / 9.0; System.out.println("Fahrenheit " + fahrenheit + " equals " + celsius + " in Celsius"); // And finally try 83 degrees Fahrenheit. fahrenheit = 83.0; celsius = (fahrenheit - 32.0) * 5.0 / 9.0; System.out.println("Fahrenheit " + fahrenheit + " equals " + celsius + " in Celsius"); System.out.println("Program terminating normally"); } // public static void main(String[] args) } // public class TempConversion1