Created
April 23, 2020 11:59
-
-
Save olegrewko/61cb795ae0ab00acd911d4683c3b24ea to your computer and use it in GitHub Desktop.
Индекс массы тела Метод
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package IgorDolgov; | |
import java.util.Scanner; | |
public class IndexMassBody { | |
static float roost, ves, index; | |
static String s, s1; | |
public static void main (String[] args) { | |
String s1 = imb(); | |
System.out.println(s1); | |
} | |
private static String imb () { | |
Scanner scanner = new Scanner(System.in); | |
System.out.println("Введите свой рост в метрах(00,0) и вес в килограммах(000,0) через пробел"); | |
float roost = scanner.nextFloat(); | |
float ves = scanner.nextFloat(); | |
index = ves / (roost * roost); | |
if (index < 16) s = "Дефицит массы"; | |
else if (index >= 16 && index < 20) s = "Недостаточный вес"; | |
else if (index >= 20 && index < 25) s = "Норма"; | |
else if (index >= 25 && index < 30) s = "Предожирение"; | |
else if (index >= 30 && index < 35) s = "Первая степень ожирения"; | |
else if (index >= 35 && index < 40) s = "Вторая степень ожирения"; | |
else s = "Морбидное ожирение"; | |
return s; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment