Lexington High School Mathematics Math Dept. Front Page  | Student Links  | Family Links 
Introduction to C++, Kevin Kelly Kelly Front Page  | C++ Course Guide | C++ Assignments | C++ Info

Assignment 11: Body Mass Index

due Monday 3/11

Write a function

float BodyMassIndex(int inches, int lbs);
that takes a person's height in inches and weight in pounds as arguments and returns the body mass index (BMI).

The BMI is defined as the weight, expressed in kilograms, divided by the square of the height expressed in meters. One inch is 0.0254 meters and one pound is 0.454 kilograms.

Write a program that prompts for a weight and height, calls BodyMassIndex, and displays the BMI. Test the program using realistic height-weight combinations for three different people.


Original source of this problem: Litvin and Litvin, "C++ for You" workbook, page 20.


Extensions

For 10 pts.: Body Mass Index is often used to determine whether someone is considered overweight or obese. Government medical guidelines have defined overweight and obese using specific ranges of BMI values. Do some Internet research to find out what these guidelines are. Have your program output an appropriate message if the BMI value falls in these ranges. (Be sure to include a comment in your program identifying the web site where you got your information.)