Padł mi laptop a na pc nie działają biblioteki graficzne więc zaczołem uczyć się javy, ale nie wiem jak zrobić ifa razem z Funkcją własną, oto kod:
import java.util.Scanner;
public class Funkcje
{
public static double potega(double x)
{
x = x* x;
return x;
}
public static double BMI(double x, double y)
{
double z;
z = x / (potega(y));
return z;
}
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Podaj mase twojego ciała, a potem wzrost");
double x = input.nextDouble();
double y = input.nextDouble();
System.out.println(BMI(x, y));
if(BMI < 18.5)
{
System.out.println("Zgrubnij");
}
}
}