This Demonstration estimates the Calories in a serving of food based on its fat, carbohydrate, and protein contents. It assumes that fats contribute 9 Calories per gram and carbohydrates and proteins contribute 4 Calories per gram each. It also calculates and displays the relative contributions of these components to the food's energy content. The thumbnail settings correspond to a serving of whole milk.
Snapshot 2: energy content of a protein-enriched bread
Snapshot 3: energy content of a macaroni and cheese product
The Demonstration uses this formula for the number of Calories :
where , , and are the masses in grams of fat, carbohydrates, and protein; these can be entered by the user with sliders. "Calories" as used by nutritionists actually means kilocalories as used in physics and chemistry, and is sometimes capitalized to emphasize that distinction. The program displays the calculated total caloric value of the food and the components' contributions in Calories and in percent. The percentages are also shown in a pie chart.