Last active
March 26, 2019 14:30
-
-
Save steverhall/dae41590f99569f5103f027b563dbac1 to your computer and use it in GitHub Desktop.
Body Mass Index Calculation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace HealthCorp.Core | |
{ | |
public class BMI | |
{ | |
private const double KILOGRAMS_PER_POUND = 0.45359237; | |
private const double METERS_PER_INCH = 0.0254; | |
public static double CalculateBMI(double weightInPounds, double heightInInches) | |
{ | |
double weightInKilos = weightInPounds * KILOGRAMS_PER_POUND; | |
double heightInMeters = heightInInches * METERS_PER_INCH; | |
double bmi = weightInKilos / (heightInMeters * heightInMeters); | |
return bmi; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment