Question: 7 . 2 4 LAB: Nutritional information ( classes / constructors ) LAB Activity 7 . 2 4 . 1 : LAB: Nutritional information (

7.24 LAB: Nutritional information (classes/constructors)
LAB
Activity
7.24.1: LAB: Nutritional information (classes/constructors)
010
Given main(, complete the FoodItem class (in files Foodltem.h and Foodltem.cpp) with constructors to initialize each food item. The default constructor should initialize the name to "Water" and all other class data members to 0.0. The second constructor should have four parameters (food name, grams of fat, grams of carbohydrates, and grams of protein) and should assign each class data member with the appropriate parameter value.
Ex: If the input is:
Water
the output is:Ex: If the input is:where M&M's is the food name, 10.0 is the grams of fat, 34.0 is the grams of carbohydrates, 2.0 is the grams of protein, and 3.0 is the number of servings, the output is:Note: The program outputs the number of calories for one serving of a food and for the input number of servings as well. The program only outputs the calories for one serving of water.
only outputs the calories for one serving of water.
3
Foodltem.cppDESKTOPCONSOLE
7.24 LAB: Nutritional information (classes/constructors)
LAB
Activity
7.24.1: LAB: Nutritional information (classes/constructors)
r 4
010
Given main(, complete the FoodItem class (in files Foodltem.h and Foodltem.cpp) with constructors to initialize each food item. The default constructor should initialize the name to "Water" and all other class data members to 0.0. The second constructor should have four parameters (food name, grams of fat, grams of carbohydrates, and grams of protein) and should assign each class data member with the appropriate parameter value.
Ex: If the input is:
Water
the output is:Ex: If the input is:where M&M's is the food name, 10.0 is the grams of fat, 34.0 is the grams of carbohydrates, 2.0 is the grams of protein, and 3.0 is the number of servings, the output is:Note: The program outputs the number of calories for one serving of a food and for the input number of servings as well. The program only outputs the calories for one serving of water.
7 . 2 4 LAB: Nutritional information ( classes /

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!