subject

Given main(), complete the FoodItem class (in files FoodItem. h and FoodItem. cpp) with constructors to initialize each food item. The default constructor should initialize the name to "None" and all other fields 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 private field with the appropriate parameter value. Ex: If the input is:

M&M's

10.0

34.0

2.0

1.0

#ifndef FOODITEMH
#define FOODITEMH

#include

using namespace std;

class FoodItem {
public:
// TODO: Declare default constructor

// TODO: Declare second constructor with arguments
// to initialize private data members

string GetName();

double GetFat();

double GetCarbs();

double GetProtein();

double GetCalories(double numServings);

void PrintInfo();

private:
string name;
double fat;
double carbs;
double protein;
};

#endif

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:30
Dave has to create animations for a game. which tool can dave use?
Answers: 3
question
Computers and Technology, 22.06.2019 16:30
Technician a says that a dry sump system uses no oil storage sump under the engine. technician b says that a wet sump system uses no oil storage sump under the engine. who is correct?
Answers: 3
question
Computers and Technology, 22.06.2019 22:00
What is the name of the option in most presentation applications with which you can modify slide elements? 1. the option enables you to modify a slide element in most presentation applications.
Answers: 3
question
Computers and Technology, 23.06.2019 03:30
Many everyday occurrences can be represented as a binary bit. for example, a door is open or closed, the stove is on or off, and the fog is asleep or awake. could relationships be represented as a binary value? give example.
Answers: 1
You know the right answer?
Given main(), complete the FoodItem class (in files FoodItem. h and FoodItem. cpp) with constructors...
Questions
question
English, 25.11.2020 22:50
question
Mathematics, 25.11.2020 22:50
question
Biology, 25.11.2020 22:50
question
Mathematics, 25.11.2020 22:50