Looks like a great forum! After many years going to the same job day after day I decided to take a class to see what may spark some interest. It's a free class, and we do not even get grades, just sort of an introductory. Well I am stuck (at least not on the first program) and have no idea what to do. Here is the objective:
A. Design a Meal class with two fields--one that holds the name of the entree, the other that holds a calorie count integer. Include a constructor that sets a Meal's fields with arguements, or uses default values when no arguements are provided.
B. Include an overloaded insertion operator function that displays a Meal's values.
C. Include an overload extraction operator that prompts a user for an entree name and calorie count for a meal.
D. Include an overloaded operator+() function that allows you to add two or more Meal object. Adding two Meal objects means adding their calorie values and creating a summary Meal object in which you store "Daily Total' in the entree field.
E. Write a main() program that declares four Meal objects named breakfast, lunch, dinner and total. Provide values for the breakfast, lunch, and dinner objects. Include the statement total = breakfast + lunch + dinner; in the program then display values for the four Meal objects.
F. Write a main() program that delcares an array for 21 Meal objects. Allow a user to enter values for 21 Meals for the week. Total these meals and display calorie total for the end of the week.
It is alot I know! For an intro class I think this one is extremely hard and again I am lost. Any suggestions? Additional sites, reference books...anything for help is greatly appreciated.
A. Design a Meal class with two fields--one that holds the name of the entree, the other that holds a calorie count integer. Include a constructor that sets a Meal's fields with arguements, or uses default values when no arguements are provided.
B. Include an overloaded insertion operator function that displays a Meal's values.
C. Include an overload extraction operator that prompts a user for an entree name and calorie count for a meal.
D. Include an overloaded operator+() function that allows you to add two or more Meal object. Adding two Meal objects means adding their calorie values and creating a summary Meal object in which you store "Daily Total' in the entree field.
E. Write a main() program that declares four Meal objects named breakfast, lunch, dinner and total. Provide values for the breakfast, lunch, and dinner objects. Include the statement total = breakfast + lunch + dinner; in the program then display values for the four Meal objects.
F. Write a main() program that delcares an array for 21 Meal objects. Allow a user to enter values for 21 Meals for the week. Total these meals and display calorie total for the end of the week.
It is alot I know! For an intro class I think this one is extremely hard and again I am lost. Any suggestions? Additional sites, reference books...anything for help is greatly appreciated.