// TempDesc Example // Input a temperature and output a description // of that temperature. import java.util.*; public class TempDesc { public static void main(String[ ] args) { // Instantiate scanner. Scanner scanner = new Scanner(System.in); // Input temperature. System.out.print("Enter a Fahrenheit temperature: "); double temperature = Double.parseDouble(scanner.nextLine( )); // Obtain temperature descriptor. String descriptor; if (temperature < 32) { descriptor = "cold"; } else if (temperature < 60) { descriptor = "chilly"; } else if (temperature < 75) { descriptor = "perfect"; } else if (temperature < 85) { descriptor = "warm"; } else { descriptor = "hot"; } // Print descriptor. System.out.print("A temperature of " + temperature + " degrees is " + descriptor + "."); } }