本帖最後由 ray 於 2012-10-12 20:07 編輯
- public class BMIManager
- {
- float mHeight;
- float mWeight;
- boolean mSex;
- float mBMI;
- String mSuggestion;
- BMIManager(float h,float w,boolean s)
- {
- this.mHeight = h;
- this.mWeight = w;
- this.mSex = s;
- }
-
- void setHeight(float h)
- {
- this.mHeight = h;
- }
-
- float getHeight()
- {
- return this.mHeight;
- }
-
- void setWeight(float w)
- {
- this.mWeight = w;
- }
-
- float getWeight()
- {
- return this.mWeight;
- }
-
- void setSex(boolean s)
- {
- this.mSex = s;
- }
-
- boolean getSex()
- {
- return this.mSex;
- }
-
- float calculateBMI()
- {
-
- return mBMI;
- }
-
- String suggestion()
- {
-
- return mSuggestion;
- }
-
- }
複製代碼 |