Exercise #4 - Surviving on Twix Bars

Re-do Exercise #3, except this time allow the user to input their Age, weight in pounds, height in Height and Inches, and have a button that displays how many twix they can eat in a label.  For your reference, the original Exercise #3 is shown below.

 


 

To maintain one's body weight, a human that is A years old, weighs K kilograms and is H centimers tall needs to consume approximately the following number of Calories per day:

 

Males:       10×K + 6.25×H - 5×A + 5

Females:    10×K + 6.25×H - 5×A - 161

 

(One Calorie is also referred to as one kilo-calorie or kcal.  A kilocalorie is what food manufacturers refer to as a single "Calorie" on food labels.)   This formula is derived from the Mifflin-St Jeor equations and is an approximation based on a person that engages in no physical activity - i.e. the person basically stays in bed all day.

 

One package of twix (i.e. two cookie bars, because nobody eats just one) is 568 Calories according to the M&M/Mars website.  If you go on the twix-only diet all day long, then the number of twix bars you would need to eat is TotalCaloriesNeeded / 568.

 

Write a program that has variables for:

Choose appropriate data types for the variables.  Set these variables to whatever values you like (or use your own).  Make additional variables for:

From these values you can use the Mifflin-St Jeor equation to compute how many twix bars that person should eat to maintain their body weight.  Make a form with a button that when clicked outputs the number.

Feel free to substitute calories for other foods if you like, for example, Hardee's "Monster Thickburger" is 1420 Calories.  See http://www.calorie-count.com/ for calorie counts for common foods.