email me at borlaj@portlandschools.org
notes previous (09/07/06) submit the dump links  
 

BMI Calculator Project - 10 points

 

Create a BMI (Body Mass Index) Calculator, that will display the persons BMI index and also a determination if the person is overweight, underweight, obese or normal. Use this for reference on the calculations. You can use the math class to square. Your finished project will look a bit like this.

BMI Categories:

  • * Underweight = <18.5
    * Normal weight = 18.5-24.9
    * Overweight = 25-29.9
    * Obesity = BMI of 30 or greater

You are going to have a gui that is going to have 3 textfields for input (for feet,inches, weight) and then 1 button (for calculate) and 1 textfield for output. Also make sure you have labels.

 

Save a class called BMICalculator.

 

Advanced: (most do at least 2, hopefully some will try all four)

  • Round BMI to 2 or 3 decimals. See here.
  • Draw a figure of the person after they have put in their information. You will modify it so that you are drawing a person there. You will draw them in much the same way you did before g.drawOval (..). You will take info about their height and weight to expand or shrink them. Have it be green if the person is classified as normal. Blue if they are overweight, black if obese, and red if underweight (by using the bmi number you calculated earlier).

     

    • So you want to access graphics in BMI Calculator you might say:
    • Graphics g=getGraphics();
    • now you can say g.drawLine(.... or anything to g
  • Use sliders instead for weight and height (see here)
  • Use pulldown to choose male female and then show a graphic of what they look like:
  • Make fields required - say something if they leave blank
  • Little extra of your choosing
  •  

     

Rubric:

This is worth 12points

  • 1 point - indenting
  • 1 point variable names
  • 4 points - gui set up appropriately
    • labels (1)
    • order (1)
    • all fields (1)
    • button (1)
  • 4 points - bmi calculated correctly
    • getting field and values correctly (1)
    • doubles used when necessary (1)
    • calculations done correctly (2)
  • 2 point - bmi spit out (1 point) with right comment (1)