-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathStudentBMI.java
More file actions
28 lines (27 loc) · 808 Bytes
/
Copy pathStudentBMI.java
File metadata and controls
28 lines (27 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package Array;
public class StudentBMI {
public static void main(String[] args) {
}
public static String[] bmiStudents(Student std[]){
String[] bmi = new String[std.length];
for(int i=0;i<bmi.length;i++){
bmi[i]=bmiCategory(std[i]);
}
return bmi;
}
public static String bmiCategory(Student std){
String bmiCategory;
if(std.getBmi()<0){
bmiCategory="none";
}else if(std.getBmi()<18.5){
bmiCategory="under weight";
}else if(std.getBmi()<25){
bmiCategory="normal weight";
}else if(std.getBmi()<30){
bmiCategory="over weight";
}else{
bmiCategory="obesity";
}
return bmiCategory;
}
}