So the compiler is saying my inches variable in the second print line statement needs to be initialized. Why is that? Why can't I leave the variable as an unknown? When I don't have the if/else statement, then it works fine.
import java.util.Scanner;
class FeetToInchesInputOutput {
public static void main(String[] args){
double feet;
double inches;
String userFeetInput;
Scanner input = new Scanner(System.in);
System.out.print("How many feet do you want to convert?");
userFeetInput = input.nextLine();
feet = Double.parseDouble(userFeetInput);
if (feet < 500.0) {
inches = feet*12;
}
else {
system.out.println("Type a number less than 500.");
}
System.out.println(feet + " feet is equal to " + inches + " inches.");
System.exit(0);
}
}