Question
need answer by 12:30 cst ASAP c++ Define a FoodItem class with the following data members : Name: string Type: V for vegetable, P for
need answer by 12:30 cst ASAP
c++
Define a FoodItem class with the following data members : Name: string Type: V for vegetable, P for protein, D for dairy, W for water Calories: an integer for the number of calories from that food item And the following function members: A default constructor which initializes a food item with the following ("water", W, 0) A parametrerized constructor that initializes a food item with provided arguments. Define member methods to get and set each data member. Define a function member Compare(FoodItem F) that compares the calorie content of two food items and returns 1 if the the calories in F are less than the calories of the instance. 2. Write the code corresponding to the implementation of each of the function members. 3. Test (on paper only !!) the class above by writing a function main() which defines two food items F1 ("apple", V, 95)F2 ("egg",P,78) and compares the calorie content of F1 and F2.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started