Reference no: EM131877662
Problem
Calories from Fat and Carbohydrates
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 consume in a day. Then, she calculates the number of calories that result from the fat using the following formula:
Calories from fat = fat grams x 9
Next, she calculates the number of calories that result from the carbohydrates using the following formula:
Calories from carbs = carbs grams x 4
Create an application that will make these calculations. In the application, you should have the following methods:
• Fat Calories-This method should accept a number of fat grams as an argument and return the number of calories from that amount of fat.
• Carb Calories-This method should accept a number of carbohydrate grams as an argument and return the number of calories from that amount of carbohydrates.