Question
Write a C/C++ program to read a list of foods from a file on disk including food name, food group, number of calories and daily
Write a C/C++ program to read a list of foods from a file on disk including food name, food group, number of calories and daily percentage amounts. Allow a user to perform various operations on this food list including listing the foods, manually selecting foods to create a meal, randomly selecting foods to create a meal, computing total calorie and daily percentage amounts for created meals, and removing foods from the list over a specified amount input from the user.
Design As discussed in the lecture notes (data modeling w/ structures), object-oriented program development begins with thinking about solutions differently. An essential element to well-developed OO programs is the design and construction of robust data models and data structures to reflect the program specification. After reading the program description above, one obvious candidate for a data model is a food object. Design this data model (and other candidates you identify) as a C/C++ struct as described in the notes. When reading, creating, and storing the list of foods from the file, you are to assume you do not know the number of foods in the file beforehand. For this reason, you must read and manage the list of foods as a linked list as described in the lecture notes (data structures linked lists). As described in the notes, create and operate on this linked list of foods in dynamic memory during the execution of the program. You may not use the STL (e.g. vector) or a fixed-size array for this project
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