import java.util.Scanner;

// initialize class
public class Temperature {
    public static void main(String[] args) {    
        // initialize scanner input
        Scanner input;
        // initialize fahrenheit double. Stores fahrenheit converted value
        double fahrenheit = 0.0;
        // initialize celsius double. Stores celsius value from user
        double celsius = 0.0;
        // initialize finalString String. Stores combined string with casting.
        String finalString;
        // initialize correctDouble double. Stores boolean value when double is correct.
        boolean correctDouble;

        // primitive double
        input = new Scanner(System.in);
        System.out.print("Enter a temperature in Celsius: ");
        try {
            celsius = input.nextDouble();
            System.out.println(celsius);
            // sets variable to True meaning the double entered is correct
            correctDouble = true;
        } catch (Exception e) {  // if not a number
            correctDouble = false;
        }
        input.close();

        // Kills prompt if value is not a double
        if(!correctDouble) {
            System.out.println("\nNot a double! Please try again");
            return;
        }
        // Mathematics for converting celsius to fahrenheit
        fahrenheit = ((celsius * 9) / 5) + 32; 

        // final formatted string with both variables
        finalString = "The temperature of " + celsius + " degrees celsius is equal to " + fahrenheit + " degrees farenheit";

        System.out.println("The temperature of " + celsius + " degrees celsius is equal to " + fahrenheit + " degrees farenheit"); 
    }
}
Temperature.main(null);
Enter a temperature in Celsius: 13.0
The temperature of 13.0 degrees celsius is equal to 55.4 degrees farenheit