I had just started learning programming and facing problem like in this one, can anyone help me what i am doing wrong here and how can i resolve it?
IntelliJ saying to add return statement but I had already added it!
public class Main {
public static void main(String[] args) {
double calcscore = calcFeetAndInchesToCentimeters(7, 7);
}
public static double calcFeetAndInchesToCentimeters(double feet, double inches) {
if ((feet >= 0) || (inches >= 0 && inches <= 12)) {
double centimeters = (feet * 12) * 2.54;
centimeters += inches * 2.54;
System.out.println(feet + " feet, " + inches + " inches = " + centimeters + " cm ");
return centimeters;
} else if ((feet < 0) || (inches < 0 && inches > 12)) {
return -1;
}
}
}