Question: 7 . 2 4 LAB: Nutritional information ( classes / constructors ) LAB Activity 7 . 2 4 . 1 : LAB: Nutritional information (
LAB: Nutritional information classesconstructors
LAB
Activity
: LAB: Nutritional information classesconstructors
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 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&Ms is the food name, is the grams of fat, is the grams of carbohydrates, is the grams of protein, and 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.
Foodltem.cppDESKTOPCONSOLE
LAB: Nutritional information classesconstructors
LAB
Activity
: LAB: Nutritional information classesconstructors
r
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 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&Ms is the food name, is the grams of fat, is the grams of carbohydrates, is the grams of protein, and 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.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
