Question: C++: Could you help me with this problem. 1 #include FoodItem.h N #include #include A W using namespace std; 6 7 // Define default constructor

C++: Could you help me with this problem.

C++: Could you help me with this problem. 1 #include "FoodItem.h" N#include #include A W using namespace std; 6 7 // Define defaultconstructor 8 9 / / Define second constructor with arguments 10 //

1 #include "FoodItem.h" N #include #include A W using namespace std; 6 7 // Define default constructor 8 9 / / Define second constructor with arguments 10 // to initialize private data members 11 12 string FoodItem: : GetName ( ) { 13 return name; 14 } 15 16 double FoodItem: : GetFat( ) { 17 return fat; 18 } 19 20 double FoodItem: : GetCarbs() { 21 return carbs; 22 } 23 24 double FoodItem: : GetProtein() { 25 return protein; 26 } 27 28 double FoodItem: : GetCalories (double numServings) { 29 // Calorie formula 30 double calories = ((fat * 9) + (carbs * 4) + (protein * 4) ) * numServings; 31 return calories; 32 } 33 34 void FoodItem: : PrintInfo( ) { 35 cout 6 using namespace std; J 8 class FoodItem { 9 public: 10 // TODO: Declare default constructor 11 12 // TODO: Declare second constructor with arguments 13 // to initialize private data members 14 15 string GetName ( ) ; 16 17 double GetFat( ) ; 18 19 double GetCarbs( ) ; 20 21 double GetProtein( ) ; 22 23 double GetCalories (double numServings) ; 24 25 void PrintInfo( ) ; 26 27 private : 28 string name; 29 double fat; 30 double carbs; 31 double protein; 32 }; 33 34 #endif

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!