This commit is contained in:
ScorpioMiku
2018-08-30 12:44:20 +08:00
parent ea403e5994
commit 6e8b39001d
2 changed files with 36 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
package com.example.ninefourone.nutritionmaster.bean;
/**
* Created by ScorpioMiku on 2018/8/30.
*/
public class User {
private float height;
private float weight;
private float BMI;
private String sex;
private int age;
private String job;
}

View File

@@ -13,12 +13,33 @@ public class CalculateUtils {
* @return
*/
public static float BMI(float height, float weight) {
height = height / 100;
if (height > 10) {
height = height / 100;
}
return weight / (height * height);
}
/**
* 通过身高获得健康的体重
*
* @param height
* @return
*/
public static float[] standardH2W(float height) {
if (height > 10) {
height = height / 100;
}
float min;
float max;
min = (float) 18.5 * height * height;
max = (float) 14 * height * height;
float[] re = {min, max};
return re;
}
/**
* 根据BMI得到体质情况
*
* @param BMI
* @return
*/