import java.util.Scanner; /** * Reads a temperature in Fahrenheit from the console and prints the equivalent * temperature in Celsius. * @author pollen */ public class TemperatureConversion { public static void main(String[] args) { Scanner in = new Scanner(System.in); // Use System.out.print so that the entered value appears on the same line as the prompt: System.out.print("Enter a temperature in F: "); double degreesF = in.nextDouble(); // Do the conversion. final double FREEZING_POINT_F = 32; double degreesC = (degreesF - FREEZING_POINT_F) * (5.0 / 9.0); System.out.println(degreesF + " degrees F equals " + degreesC + " degrees C."); } }