Learning Java: Celcius to Fahrenheit Conversion This is a short Celcius to Fahrenheit conversion calculator that calculates the average of all entries before exiting. This program performs exactly to the required specification.
I have some concern about the cleanliness of the multiple variable declaration and initialization to zero in a single line. I've seen this done on a few sites, and it works, but is it conventional to see Java variables initialized in this way?
Regarding assigning everything zero, is it more or less appropriate to give a variable a value when declaring it?
I'm also concerned with the double conversion variable in the if statement, is this is scoped properly, or should conversion be declared with the other variables?
These were just a few of points I noticed myself, please review for syntax, convention, and readability.
package temperature;

import java.util.Scanner;

public class Temperature {

public static void main(String[] args) {       
    int counter = 0;
    double input = 0;
    double celciusInputs, fahrenheitInputs = celciusInputs = 0;

    Scanner in = new Scanner(System.in);

    do {
      System.out.print(&quot;Enter Temp in Centigrade or &lt;= -100.0 to quit: &quot;);
      input = in.nextDouble();
      if (input &gt; -100.0) {
        double conversion = ((9.0/5.0) * input) + 32.0;
        System.out.printf(&quot;Temperature: F(%.1f) C(%.1f)\n&quot;, conversion, input);
        celciusInputs += input;
        fahrenheitInputs += conversion;
        counter += 1;
      }
    } while (input &gt; -100.0); 
    
    // Calculate averages
    celciusInputs /= counter;
    fahrenheitInputs /= counter;
    
    System.out.printf(&quot;Average: Centigrade (%.1f) Average: Fahrenheit(%.1f)&quot;,
            celciusInputs, fahrenheitInputs);
    
    in.close();
  }
}
double celciusInputs, fahrenheitInputs = celciusInputs = 0;

Variables declared and initialized this way are hard to read. Prefer:
double celciusInputs = 0;
double fahrenheitInputs = 0;



double celciusInputs, fahrenheitInputs = celciusInputs = 0;

The Inputs in the name signals to me that it is an array of values. It is not. Prefer celciusInputsSum and fahrenheitInputsSum


System.out.print(&quot;Enter Temp in Centigrade or &lt;= -100.0 to quit: &quot;);

Spell out Temp as temperature to avoid confusion. Centigrade should also be worded as &quot;Celsius&quot; to avoid confusion (even variable names use &quot;celsius&quot;, not &quot;centigrade&quot;)
Why is minimum allowed temperature -100.0 °C? Absolute zero is at -273.15 °C


input = in.nextDouble();

Error handling should be added. What do you want to do when user enters foobar as input?


double conversion = ((9.0/5.0) * input) + 32.0;

From this line alone, we do not know the units. Prefer fahrenheitConverted or similar


counter += 1;

Instead of summing the inputs, perhaps consider ArrayList to store the inputs. The sum can only go so far before celciusInputs and fahrenheitInputs overflow. It also provides more flexibility if you want to do other calculations (such as calculating mode and median, along with the mean/average)


celciusInputs /= counter;
fahrenheitInputs /= counter;


Doing it like this means the variable names no longer reflect its contents. Prefer using new variables like this: double celsiusInputAverage = celciusInputs / numInputs


public static void main(String[] args) {

This line is missing indentation (2 spaces)