Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. /**
  2. * Write a description of class BMR here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7.  
  8. import java.util.Scanner;
  9. public class BMR
  10. {
  11. public static void main(String[] args)
  12. {
  13. Scanner in = new Scanner(System.in);
  14. System.out.print("Enter your name: ");
  15. String name = in.nextLine();
  16. System.out.print("Gender (M or F): ");
  17. String maleOrFemale = in.next();
  18. char male = maleOrFemale.charAt(0);
  19. System.out.print("Enter your age: ");
  20. int age = in.nextInt();
  21. System.out.print("Height in inches: ");
  22. double height = in.nextDouble();
  23. System.out.print("Weight in pounds: ");
  24. double weight = in.nextDouble();
  25. System.out.print("\n\n\n");
  26. System.out.print("Calculate Your Basal Metabolism");
  27. System.out.print("\n\n");
  28.  
  29. weight *= 0.45359237;
  30. height *= 2.54;
  31. Math.round(weight*10)/10
  32. Math.round(height*10)/10
  33.  
  34. System.out.println("Name: " + name);
  35. System.out.println("Gender: " + maleOrFemale);
  36. System.out.println("age: " + age);
  37. System.out.println("Weight (kg): " + weight);
  38. System.out.println("Height (cm): " + height);
  39.  
  40.  
  41. /* boolean isMale = male == 'M';
  42. if(isMale)
  43. System.out.println("yep");
  44. else
  45. System.out.println("no");*/
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement