📄 calmeasure.java
字号:
/* * CalMeasure.java * * Created on November 5, 2002, 7:13 PM */package jwadbook.bean;/** * * @author cai */public class CalMeasure { //Calendar calendar = null; //Date currentDate; int cm; int weight; int m; int age; int result = 0; String gender; float activity; public CalMeasure() { } public int getcm() { return this.cm; } public int getWeight() { return this.weight; } public int getM() { return this.m; } public int getAge() { return this.age; } public String getGender() { return this.gender; } public float getActivity() { return this.activity; } public int getResult() { return calculate(); } public void setCm(int cm_) { this.cm = cm_; } public void setWeight(int weight_) { this.weight = weight_; } public void setM(int m_) { this.m = m_; } public void setAge(int age_) { this.age = age_; } public void setGender(String gender_) { this.gender = gender_; } public void setActivity(float activity_) { this.activity = activity_; } private int calculate() { if (this.result!=0) { return this.result; } else { // Gets Rate of Metabolism (BMR) // Step One: WeightSex float fltWM = (float)(weight * 6.2); float fltWW = (float)(weight * 4.4); // Step Two: Height, HeightSex int height = (int)((m * 100) + cm); float fltHM = (float)(height * 5); float fltHW = (float)(height * 1.85); // Step Three: AgeSex float fltAM = (float)(age * 6.8); float fltAW = (float)(age * 4.7); float fltBMR; // Calculate: Basal Metabolic Rate if (gender.equals("male")) { fltBMR = (float)(((fltWM + fltHM) - fltAM) + 666); } else { fltBMR = (float)(((fltWW + fltHW) - fltAW) + 655); } // Gets Calories for Physical Activity, // Energy for Digestion and Absorption, // and Total Energy Needs float fltCPA = (float)(fltBMR * activity); float fltEDA = (float)((fltBMR + fltCPA) * 0.10); float fltTEN = (float)(fltBMR + fltCPA + fltEDA); this.result = (int)fltTEN; return this.result; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -