Welcome to Computer Programming

 

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 up to <25
  • Overweight : >=25 and <30
  • 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.

 

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
  • Find images online and use the method, built in to BorlandBase to drawImage - drawImage("filename",x,y) depending on the size of the person.(here's image male, female) to show what they look like
  • 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 12 points

  • 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)