Dans l'instruction suivante, j'obtiens une erreur à la ligne 30. Pouvez-vous me dire qui sait?
import java.util.Scanner;
class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in);
System.out.println ("nom:"); String firstName = scanner.next(); System.out.println ("Nom:"); String lastName = scanner.next(); System.out.println ("âge:"); int age = scanner.nextInt(); System.out.println ("hauteur (m):"); double height = scanner.nextDouble(); System.out.println ("Poids (kg):"); double weight = scanner.nextDouble();
sub(firstName,lastName,age,height,weight);
}
public static void sub(String firstName, String lastName, int age, double height, double weight) { System.out.println ("Le nom est" + prénom + "" + nom + "); System.out.println ("L'âge est" + âge + "années"); if (age> = 20) {System.out.println ("adulte");} else {System.out.println ("Mineur");} System.out.println ("hauteur est" + hauteur + "m"); System.out.println ("Le poids est" + poids + "kg"); System.out.println ("IMC est" + Math.round (bmi (poids, taille)) + ""); ☆ if (isHealthy (bmi)) {System.out.println ("sain");} else {System.out.println ("pas sain");}
}
public static double bmi(double weight, double height){ return weight / height / height; }
public static boolean isHealthy(double bmi){ return bmi>=18.5&&bmi<25;
}
}
Recommended Posts