The body mass index (BMI) is an attempt to quantify the amount of tissue mass (muscle, fat, and bone) in an individual, and then categorize that person as underweight, normal weight, overweight, or obese based on that value.
The BMI was conceived by Adolphe Quételet between 1830 and 1850 its formula is
BMI = |
| , |
where m is the mass of an individual (in kilograms) ans h is its height (en meters).
Its interpretation (only for adults) is the following:
BMI | Interpretation |
less than 18 | underweight |
from 18 to 25 | normal weight |
from 25 to 30 | overweight |
from 30 to 40 | obese |
more than 40 | severely obese |
Write a Haskell program to interpret the body mass index of several individuals.
Input
Input is organized in lines. Each line has three elements separated with whitespaces: the name, the weight and the height. The last line is special and only contains an asterisc.
Output
For each individual, print his/her name and the interpretation of his/her BMI.
Observation
In order to solve this problem in Haskell, write a main action and choose the GHC compiler.
Input
John 76 1.80 Mary 66 1.50 Phil 100 2.01 Raymond 90.9 1.70 Ann 40 1.70 Edith 120 1.60 *
Output
John: normal weight Mary: overweight Phil: normal weight Raymond: obese Ann: underweight Edith: severely obese