Skip to content

Update CalorieCalculator.java #452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

prashant152005
Copy link
Contributor

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.

@kishanrajput23 kishanrajput23 merged commit 7a1580e into kishanrajput23:main Mar 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants