Java-Projects-Collections icon indicating copy to clipboard operation
Java-Projects-Collections copied to clipboard

Update CalorieCalculator.java

Open prashant152005 opened this issue 8 months ago • 0 comments

Key Changes:

  1. Constants: Used constants to store BMR coefficients and activity multipliers for readability and easier maintenance.
  2. Input Validation: Added validation for user input (gender, age, weight, height, and activity level) to ensure they are correct and meaningful.
  3. Better Error Handling: If invalid data is entered (like a non-integer for age or weight), the program will prompt the user to enter valid data again.
  4. Cleaner Output Formatting: The output is formatted to remove unnecessary decimals and display numbers cleanly.
  5. Helper Methods: Encapsulated logic for input validation and BMR/Calorie calculation into separate methods for better code organization and reusability.

prashant152005 avatar Feb 09 '25 09:02 prashant152005