Guest User

Untitled

a guest
Feb 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. public double getBMI( String weightUnit, String HeightUnit, double h, double, w){
  2. double weight;
  3. if(weightUnit.equals("pound"){
  4. weight = w * poundConversion;
  5.  
  6. }
  7. if(heightUnit.equals("foot") && (weightUnit.equals("pound") || weightUnit.equals("kilogram"))) {
  8. double height = h * footConversion;
  9. return weight / (height * height);
  10. }
  11. else if (heightUnit.equals("inch" && (weightUnit.equals("pound") || weightUnit.equals("kilogram"))){
  12. double height = h * inchConversion;
  13. return weight / (height * height);
  14. }
  15. return -1;
  16. }
Add Comment
Please, Sign In to add comment