Java Primitives Notebook
import java.util.Scanner;
public class Primitives {
public static void main(String[] args) {
Scanner input;
double fahrenheit = 0.0;
double celsius = 0.0;
boolean correctDouble;
input = new Scanner(System.in);
System.out.print("Enter a temperature in Fahrenheit: ");
try {
fahrenheit = input.nextDouble();
System.out.println(fahrenheit);
correctDouble = true;
} catch (Exception e) {
correctDouble = false;
}
input.close();
celsius = ((fahrenheit-32)*5)/9;
System.out.println( fahrenheit + " °F is = " + celsius + " °C");
}
}
Primitives.main(null);