So I've been getting the error The method interpretBMI(double) is undefined for the type Main and The method calculateBMI(double, double) is undefined for the type Main.
Below is where I'm calling the functions. The functions are defined in a separate class in Eclipse(Jdk 17.0.1).
for(int i=0;i<Size;i++) {
String name = nameArray[i];
int age = ageArray[i];
double weight = weightArray[i];
double height = heightArray[i];
double BMI2 = calculateBMI(weight,height);
interpretArray[i] = "** The BMI result for " +name+ " ( Age: "+age+ " Weight: "+weight+ " Height: "+height+") is\n"+interpretBMI(BMI2);
System.out.println(interpretArray[i]);
}
This is the class they're defined in. They are in package part2, I tried using the default package but I got the same errors. My main method is static, all my functions are static but I get the error anyway, I could find no answer online. Thanks in advance.
package part2;
public class BmiFunctions {
public static double calculateBMI(double weight, double height) {
double kg= weight*(0.45359237); // converting pounds to kilograms
double mt = height*(0.0254); // converting inches to meters
double BMI = kg/(mt*mt); // calculating BMI
return BMI;
}
public static String interpretBMI(double bmi) {
if(bmi < 18.5)
return "Underweight";
else if(18.5 <= bmi && bmi <= 25.0)
return "Normal";
else if(25.0 <= bmi && bmi <= 30.0)
return "Overweight";
else if(30.0 <= bmi)
return "Obese";
else
return "Error";
}
}