24/11/2012

How to make a BMI Calculator?- JAVA CODE,

BMI stand for body mass index and the calculator which is use to calculate the BMI is called BMI Calculator or BMI Index calculator. It is a scale which use to evaluate health condition of a person. and the scale for BMI calculator is  as under
  • Under weight     -      below 18.5
  • Normal              -      18.5 to 24.9
  • Over weight       -       25 to  29.9
  • Obesity              -      above 30
The mathematical formula for calculating BMI is = weight/(height)^2
( convert the height into meter and weight into Kg)

If you want to create a widget for you visitors just copy the undermentioned java code and paste it into your add gadget box

<SCRIPT LANGUAGE="JavaScript">
<!--
function calcBMIcalculator(form, feet, inches, pounds) {
if(feet=="") { alert("Please enter height in feet"); return false; }
if(inches=="") { alert("Please enter in inches"); return false; }
if(pounds=="") { alert("Please enter your weight"); return false; }
TotalInches = eval(feet*12) + eval(inches)
Meters = TotalInches/39.36
Kilos = pounds/2.205
Square = Meters * Meters
form.calcval.value = (Math.round(Kilos/Square))
} // -->
</SCRIPT>
<font face=arial size=2>
<H3>Calculate Your Body Mass Index (BMI)</H3>
<FORM NAME="bmi">
Enter your height in feet:
<INPUT TYPE="TEXT" NAME="feet" SIZE=5>
and inches:
<INPUT TYPE="TEXT" NAME="inches" SIZE=5><BR><BR>
Enter your weight in pounds:
<INPUT TYPE="TEXT" NAME="pounds" SIZE=5><BR><BR>
<BR>
<INPUT TYPE="BUTTON" name="calc" value="Calculate BMI"
onClick="calcBMIcalculator(this.form,this.form.feet.value,this.form.inches.value,this.form.pounds.value)">
<BR><BR>
<b>Your result: <INPUT TYPE="TEXT" name="calcval" size=10></b>
</FORM>
<P>
BMI below 18.5 = Underweight<BR>
BMI between 18.5 and 24.9 = Healthy Range<BR>
BMI between 25 and 29.9 = Overweight <BR>
BMI over 30 = Obese
Need to lose weight fast? I HIGHLY recommend Click Here!