Question: C + + Nutritional information ( classes / constructors ) . Given main ( ) , complete the FoodItems class ( in files FoodItem.h and

C++ Nutritional information (classes/constructors). Given main(), complete the FoodItems class (in files FoodItem.h and FoodItem.cpp) with constructors to initialize each food item. The default constructor shoukd 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.
Example: If the input is: Water
the output is:
Nutritional information per serving of Water:
Fat: 0.00 g
Carbohydrates: 0.00 g
Protein: 0.00 g
Number of calories for 1.00 serving(s): 0.00

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!