Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void getResult() {
- tvHeight.setText(String.format("身高:%.2f CM",height));
- tvWeight.setText(String.format("體重:%.2f KG",weight));
- bmi=weight / ((height/100)*(height/100));
- tvBmi.setText(String.format("BMI:%.2f",bmi));
- String result;
- if(bmi>=35){
- result="重度肥胖";
- photoId=0;
- } else if(bmi>=30){
- result="中度肥胖";
- photoId=1;
- }else if(bmi>=27){
- result="輕度肥胖";
- photoId=2;
- }else if(bmi>=24){
- result="過重";
- photoId=3;
- }else if(bmi>=18.5){
- result="標準體重";
- photoId=4;
- }else{
- result="體重過輕";
- photoId=5;
- }
- tvResult.setText(result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement