Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. /**
  2. * @Sean Wilson
  3. * @version 11/15/10
  4. */
  5. import java.util.Scanner;
  6. public class TDEE
  7. {
  8. public static void main(String[] args)
  9. {
  10. Scanner intInput = new Scanner(System.in);
  11. Scanner stringInput = new Scanner(System.in);
  12.  
  13. System.out.print("Please enter your name: ");
  14. String name = stringInput.nextLine();
  15. System.out.print("Please enter your BMR: ");
  16. int BMR = intInput.nextInt();
  17. System.out.print("Please enter your Gender (M/F): ");
  18. String genderTemp1 = stringInput.nextLine();
  19. char genderTemp2 = genderTemp1.charAt(0);
  20. char gender = Character.toLowerCase(genderTemp2);
  21. if(gender !='M' || gender !='F')
  22. {
  23. System.out.print("Invalid Gender");
  24. }
  25.  
  26. System.out.println("");
  27. System.out.println("Select Your Activity Level");
  28. System.out.println("[A] Resting (Sleeping, Reclining)");
  29. System.out.println("[B] Sedentary (Minimal Movement)");
  30. System.out.println("[C] Light (Sitting, Standing)");
  31. System.out.println("[D] Moderate (Light Manual Labor, Dancing, Riding Bike)");
  32. System.out.println("[E] Very Active (Team Sports, Hard Manual Labor)");
  33. System.out.println("[F] Extremely Active (Full-Time Athelete, Heavy Manual Labor)" + "\n");
  34. System.out.print("Enter the letter corresponding to your activity level: ");
  35. String menuChoice = stringInput.nextLine();
  36. System.out.println("");
  37.  
  38. double activityFactor;
  39. double TDEE = BMR * activityFactor;
  40.  
  41. if(gender=='M')
  42. {
  43. if(menuChoice.equalsIgnoreCase("A"))
  44. {
  45. activityFactor = 1.0;
  46. }
  47. else if(menuChoice.equalsIgnoreCase("B"))
  48. {
  49. activityFactor = 1.3;
  50. }
  51. else if(menuChoice.equalsIgnoreCase("C"))
  52. {
  53. activityFactor = 1.6;
  54. }
  55. else if(menuChoice.equalsIgnoreCase("D"))
  56. {
  57. activityFactor = 1.7;
  58. }
  59. else if(menuChoice.equalsIgnoreCase("E"))
  60. {
  61. activityFactor = 2.1;
  62. }
  63. else if(menuChoice.equalsIgnoreCase("F"))
  64. {
  65. activityFactor = 2.4;
  66. }
  67. else
  68. {
  69. activityFactor = 0;
  70. System.out.print("Invalid Menu Selection");
  71. }
  72. }
  73. else if(gender=='F')
  74. {
  75. if(menuChoice.equalsIgnoreCase("A"))
  76. {
  77. activityFactor = 1.0;
  78. }
  79. else if(menuChoice.equalsIgnoreCase("B"))
  80. {
  81. activityFactor = 1.3;
  82. }
  83. else if(menuChoice.equalsIgnoreCase("C"))
  84. {
  85. activityFactor = 1.5;
  86. }
  87. else if(menuChoice.equalsIgnoreCase("D"))
  88. {
  89. activityFactor = 1.6;
  90. }
  91. else if(menuChoice.equalsIgnoreCase("E"))
  92. {
  93. activityFactor = 1.9;
  94. }
  95. else if(menuChoice.equalsIgnoreCase("F"))
  96. {
  97. activityFactor = 2.2;
  98. }
  99. else
  100. {
  101. activityFactor = 0;
  102. System.out.print("Invalid Menu Selection");
  103. }
  104. }
  105. else
  106. {
  107. activityFactor = 0;
  108. System.out.print("Invalid Gender");
  109. }
  110.  
  111. System.out.print("Name: " + name + "\t\t\tGender: " + gender + "\n");
  112. System.out.print("BMR: " + BMR + " calories\t\tActivity Factor: " + activityFactor + "\n");
  113. System.out.print("TDEE: " + TDEE + " calories");
  114. }
  115.  
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement