– A nutritionist who works for a fitness club helps members by evaluating
their diets. As part of her evaluation, she asks members for the number of fat grams and
carbohydrate grams that they consumed in a day. Then, she calculates the number of calories that
result from the fat, using the following formula:
calories from fat= fat grams * 9
Next, she calculates the number of calories that result from the carbohydrates, using the following
formula:
calories from carbs= carb grams * 4
The nutritionist asks you to write a program that will make these calculations.
Code for your program using following methods:
fatCalories-This method should accept a number of fat grams as an argument and return
the number of calories from that amount of fat.
carcCalories- This method should accept a number of carbohydrate grams as an argument
and return the number of calories from that amount of carbohydates.
Answers
Answered by
0
Answer:
A nutritionist who works for a fitness club helps members by evaluating their diets. As part
of her evaluation, she asks members for the number of fat grams and carbohydrate grams
that they consumed in a day. Then, she calculates the number of calories that result from
the fat, using the following formula:
\text{calories from fat = fat grams} \times 9$$Next, she calculates the number of calories that result from the carbohydrates, using the following formula: $$\text{calories from carbs = carb grams} \times 4$$The nutritionist asks you to write a program that will make these calculations.
Similar questions
Biology,
2 months ago
Science,
2 months ago
Computer Science,
5 months ago
English,
5 months ago
Math,
11 months ago