1  #include <iostream>
  2  #include "BMI.h"
  3  using namespace std;
  4  
  5  BMI::BMI(const string& newName, int newAge, 
  6    double newWeight, double newHeight)
  7  {
  8    name = newName;
  9    age = newAge;
 10    weight = newWeight;
 11    height = newHeight;
 12  }
 13  
 14  BMI::BMI(const string& newName, double newWeight, double newHeight)
 15  {
 16    name = newName;
 17    age = 20;
 18    weight = newWeight;
 19    height = newHeight;
 20  }
 21  
 22  double BMI::getBMI() const
 23  {
 24    const double KILOGRAMS_PER_POUND = 0.45359237;
 25    const double METERS_PER_INCH = 0.0254;
 26    double bmi = weight * KILOGRAMS_PER_POUND /
 27      ((height * METERS_PER_INCH) * (height * METERS_PER_INCH));
 28    return bmi;
 29  }
 30  
 31  string BMI::getStatus() const
 32  {
 33    double bmi = getBMI();
 34    if (bmi < 18.5)
 35      return "Underweight";
 36    else if (bmi < 25)
 37      return "Normal";
 38    else if (bmi < 30)
 39      return "Overweight";
 40    else
 41      return "Obese";
 42  }
 43  
 44  string BMI::getName() const
 45  {
 46    return name;
 47  }
 48  
 49  int BMI::getAge() const
 50  {
 51    return age;
 52  }
 53  
 54  double BMI::getWeight() const
 55  {
 56    return weight;
 57  }
 58  
 59  double BMI::getHeight() const
 60  {
 61    return height;
 62  }