Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. private void getResult() {
  2. tvHeight.setText(String.format("身高:%.2f CM",height));
  3. tvWeight.setText(String.format("體重:%.2f KG",weight));
  4. bmi=weight / ((height/100)*(height/100));
  5. tvBmi.setText(String.format("BMI:%.2f",bmi));
  6. String result;
  7.  
  8. if(bmi>=35){
  9. result="重度肥胖";
  10. photoId=0;
  11. } else if(bmi>=30){
  12. result="中度肥胖";
  13. photoId=1;
  14. }else if(bmi>=27){
  15. result="輕度肥胖";
  16. photoId=2;
  17. }else if(bmi>=24){
  18. result="過重";
  19. photoId=3;
  20. }else if(bmi>=18.5){
  21. result="標準體重";
  22. photoId=4;
  23. }else{
  24. result="體重過輕";
  25. photoId=5;
  26. }
  27. tvResult.setText(result);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement