Question: Create a class named Meal that includes a string variable for the meal s description ( for example, Dinner ) , an array

Create a class namedMealthat includes a string variable for the meals description (for example,"Dinner"), an array of strings that holds up to five of theMeals components (for example,"roasted chicken","mashed potatoes", and"green beans"), and a numeric variable that holds the calorie count. Include a constructor that prompts the user for a value for each field. Also create two overloaded methods nameddisplay(). The first method takes no parameters and displays theMealdetails. The second takes a numeric parameter that indicates how many of theMeals components to display, or an error message if the parameter value is less than 0 or more than 5.
Create an application that declares twoMealobjects, sets their values, and demonstrates how both method versions can be called.(11.1)

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