Tutorial 026 Body Mass Indicator Calculator (BMI)
According to website National Center
for Chronic Disease Prevention and Health Promotion
BMI is a useful measure of your personal weight in relation to health.
BMI is defined as :
bmi = (weight in kg)/(height in metres*height in
metres)
Conversion to pounds and inches yields the formula:
bmi = 703 * (weight in pounds)/(height in inches*height
in inches)
The following program employs this formula to calculate the bmi using
the usual stones and pounds for weight and feet and inches for the
height.
REM: BMI Calculator
for adults over 20
REM: Pounds, feet and inches version
REM: Richard Weston, 18 May 2003
MODE8
COLOUR1
PRINTTAB(5,1)"Body mass index (BMI)
calculator for adults over 20 yrs"
COLOUR7
PRINTTAB(1,3)"Input your height in
feet and inches :"
INPUTTAB(1,5)"feet : "ft
INPUTTAB(1,6)"inches : "ins
PRINTTAB(1,8)"Input your weight in
stones and pounds"
INPUTTAB(1,10)"stones : "st
INPUTTAB(1,11)"pounds : "p
:
p=p+(14*st)
ins=ins+(12*ft)
:
bmi=703*p/(ins^2)
:
bmi=0.1*INT(bmi*10+0.5)
:
PRINT''" Your BMI is ";bmi
:
COLOUR3
PRINT''TAB(3)"under 18.5
underweight"
PRINT'TAB(3) "18.5 to 24.9
normal range"
PRINT'TAB(3) "25 to 29.9
overweight"
PRINT'TAB(3) "over 30
obese"
COLOUR1
PRINT'TAB(5)"Press SPACE to repeat"
G=GET
RUN
For me my current stats give the output:
Body mass index (BMI)
calculator for adults over 20 yrs
Input your height in feet and inches :
feet : 5
inches : 9
Input your weight in stones and pounds
stones : 9
pounds : 12
Your BMI is 20.4
under 18.5
underweight
18.5 to 24.9 normal range
25 to 29.9 overweight
over 30
obese
Press SPACE to repeat
Exercise :
Convert this to work in kg and cm. Why not send me your "souped up
version" for publication here.
Weight Ranges
Using the BMI values above, the following program gives the corresponding
weights for a given height:
REM : Weight Watcher
REM : Richard Weston
REM: 22nd May 2003
MODE8
COLOUR1
PRINTTAB(5,1)"Weight ranges for an adult
over 20 yrs"
COLOUR7
PRINTTAB(1,3)"Input your height in feet
and inches :"
INPUTTAB(1,5)"feet : "ft
INPUTTAB(1,6)"inches : "ins
ins=ins+(ft*12)
underw=(ins^2)*18.5/703
upperw=(ins^2)*24.9/703
overw=(ins^2)*30/703
COLOUR3
PRINT
PROCstones(underw)
PRINT" - underweight"'
PROCstones(upperw)
PRINT" - overweight"'
PROCstones(overw)
PRINT" - obese"'
COLOUR2
PRINT'TAB(5)"Press SPACE to repeat"
G=GET
RUN
:
DEF PROCstones(w)
stones=w DIV 14
pounds=w MOD 14
PRINT;stones;" stones ";pounds;" pounds";
ENDPROC
For my data this gives an output :
Weight ranges for an adult
over 20 yrs
Input your height in feet and inches :
feet : 5
inches : 9
8 stones 13 pounds - underweight
12 stones 0 pounds - overweight
14 stones 7 pounds - obese
Press SPACE to repeat
Next Tutorial
Richard Weston's Homepage