Question
help Overview In this project you will be creating an application to track a person's nutritional intake for the day. Required Materials Laptop with Internet
help
Overview
In this project you will be creating an application to track a person's nutritional intake for the day.
Required Materials
- Laptop with Internet Connection
- AWS Account with Cloud9 instance configured
Description
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. For example,
1: Apple 2: French Fries 3: Burger 4: Instant Ramen 5: Protein Bar .... 11: Finished
Once the user has finished selecting items, they should enter the item number associated with "Finished". The program should then display the total nutritional value of all the selected items and display some statistics to the user.
Requirements
- The code should be well formatted with proper indentation, variable names, and function structure.
- You should construct 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's member variables should only be accessible via public accessors or mutators, if necessary. It should contain no public member variables.
- Hint: Think of this class like the nutrition label on the back of some packaged food item.
- 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.
- Totalfat: less than 70g.
- Total sugars: less than 30g.
- Protein: Approximately 50g.
- Sodium: less than2,300 mg.
- Be sure to separate your class into a separate .h and .cpp files. Your .h file should include an "include guard".
Hints
- It is recommended that you use a vector or array of the food item class to represent the 10-item "menu" that the use selects from
- Use another food item class to represent the total intake for the day. The use the overridden addition operator to continuously add items from the menu to this total
How to Submit
Upload your source files (.cpp, .h) here when completed. Also upload your compiled executable file (if your code compiles).
NOTE:I am a PhD not an MD. Do not actually take any nutritional values from this exam question seriously. I am not responsible for your diet or any malnutrition you incur from following recommendations from this program. These values are approximate values that I googled.
Rubric
Nutrition Tracker Rubric
Criteria | Ratings | Pts | |||
---|---|---|---|---|---|
This criterion is linked to a Learning OutcomeFood item class is created according to the descriptionClass contains no public member variables. All specified member variables are present |
| 25pts | |||
This criterion is linked to a Learning OutcomeUser input loop functions properlyHandles unexpected input without crashing. Continues to loop until the 'finished' option is selected. Items are properly displayed. There are at least 10 selectable items on the first iteration. |
| 25pts | |||
This criterion is linked to a Learning OutcomeAddition operation is overloadedThe addition operation is properly overloaded. The resulting class will contain the combined values of each nutrient member variable. |
| 25pts | |||
This criterion is linked to a Learning OutcomeClass files are stored in separate filesThe class is separated into .cpp and .h files properly. |
| 10pts | |||
This criterion is linked to a Learning OutcomeCode is neatly formatted |
| 5pts | |||
This criterion is linked to a Learning OutcomeInvalid user input doesn't crash the program |
| 10pts | |||
Total Points:100 |
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