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:
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:
A person's age in years
A person's weight in pounds
A person's height in feet and inches (two variables)
Choose appropriate data types for the variables. Set these variables to whatever values you like (or use your own). Make additional variables for:
The person's weight in kilograms. One kilogram is 2.2 pounds.
The person's height in centimeters. Compute this by converting the person's height in inches (12 inches per foot) and then from inches to centimeters (2.54 centimeters per inch).
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.