d. Fill in the underlines below to complete the definition of the default constructor of the class foodType so that the private member variables are initialized to 0, 0, 0.0, 0, 0.0, 0.0, respectively.
Answer:
foodType()
{
set("", 0, 0.0, 0, 0.0, 0.0);
}
e. Fill in the underlines below to complete the definition of the constructor with parameters of the class foodType so that the private member variables are initialized according to the parameters. The values of the int and double instance variables must be nonnegative.
Answer:
foodType(string s, int c, double f, int su, double cr, double p)
{
set(s, c, f, su, cr, p);
}
f. Fill in the underlines below to write a C++ statement that prints the value of the object fruit2.
Answer:
cout << fruit2;
d. Fill in the underlines below to complete the definition of the default constructor of the class foodType so that the private member variables are initialized to 0, 0, 0.0, 0, 0.0, 0.0, respectively.
Answer:
foodType()
{
set("", 0, 0.0, 0, 0.0, 0.0);
}
Fill in the underlines below to complete the definition of the constructor with parameters of the class foodType so that the private member variables are initialized according to the parameters. The values of the int and double instance variables must be nonnegative
Answer:
foodType(string s, int c, double f, int su, double cr, double p)
{
set(s, c, f, su, cr, p);
}
f. Fill in the underlines below to write a C++ statement that prints the value of the object fruit
Answer:
cout << fruit2;