Question: Need a little help on this C++ code Create an application for tracking a person's nutritional intake for the day. The program should prompt the

Need a little help on this C++ code

Create an application for tracking a person's nutritional intake for the day. The program should prompt the user to choose a food item from a list of options. The program should continue looping until the user enters the option to stop. At that time the total nutritional value of all of the food items selected should be combined and displayed. You may present the list of options as enumerated items with a description. Once the user has finished selecting items, the program should display the total nutritional value of all the selected items and display some statistics to the user.

You should create a class to contain a "Food Item". This food item class should track the name of the food, calories, total fat, total sugars, protein, and sodium. The class' member variables should only be accessible via public accessors or mutators, if necessary. It should contain no public member variables.

Override the addition operator to allow food items to be added together. The result of the addition should populate a class containing the combined nutritional value of the two items. Use this operator to sum up the nutritional value of all the food items selected by the user.

The program should loop and continuously add new items into a total value represented by an instance of the "Food Item" class representing the day's total nutritional intake. The program should display at least 10 pre-populated items for the user to choose from. The program should also offer an option for the user to enter when they have completed selecting the foods consumed for the day.

After all food entries have been entered into the console and the total nutritional value has been computed, display to the user if they have exceeded any of the recommended intakes for an average adult:

  • Energy: Approximately 2,000 cal.
  • Total fat: less than 70g.
  • Total sugars: less than 30g.
  • Protein: Approximately 50g.
  • Sodium: less than 2,300 mg.

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 Databases Questions!