Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:00, 2alshawe201
The three logical operators used to write compound conditions are "and," "or," and "not." a: true b: false
Answers: 2
image
Computers and Technology, 23.06.2019 02:00, kayladgranger
Which demographic challenge is europe currently experiencing? a. an aging and decreasing population b. a baby boomc. an unequal distribution between males and females d. a large group of teenagers moving through the school system(i chose a but i'm unsure)
Answers: 1
image
Computers and Technology, 23.06.2019 05:00, sharkboy578
Acompany is inviting design for its new corporate logo from its users. this is an example of ? a. crowdfunding b. crowdvoting c. crowdsourced design d. crowdtracking
Answers: 3
image
Computers and Technology, 24.06.2019 02:30, journeyhile5
How to apply the fly in effect to objects on a slide
Answers: 1
Do you know the correct answer?
Given main(), complete the FoodItem class (in files FoodItem. h and FoodItem. cpp) with constructors...

Questions in other subjects:

Konu
History, 07.05.2020 07:03
Konu
Mathematics, 07.05.2020 07:03