[Solved] In Java, how can I get a variable to print two doubles separately instead of adding them?


You just need to print the number as a string.
replace outputDegreesF() with

public static void outputDegreesF(double degreesC) {
    double fahrenheit = 32.0 + (degreesC * 9.0 / 5.0);

    System.out.print(degreesC + " " + fahrenheit); // Easier
    // Or
    System.out.printf("%.7f %.7f", degreesC, fahrenheit); // Used more and lets you format
}

If you want to change the amount of decimal places printf prints, change the 7 to the amount you want.

PS:
You don’t need the System.out.println(); line since in the previous line you already add a new line (the \n in the string)

2

solved In Java, how can I get a variable to print two doubles separately instead of adding them?