Complete the following tasks:a. Create a class named Meal that

Complete the following tasks:

a. Create a class named Meal that includes a string variable for the meal’s description, an array of strings that holds up to five of the Meal’s components (for example, “roasted chicken”, “mashed potatoes”, and “green beans”), and a numeric variable that holds the calorie count. Include a method that prompts the user for a value for each field. Also create two overloaded methods named display(). The first method takes no parameters and displays the Meal details. The second takes a numeric parameter that indicates how many of the Meal’s components to display, or an error message if the parameter value is less than 0 or more than 5.

b. Create an application that declares two Meal objects, sets their values, and demonstrates how both method versions can be called.

 

Leave a Comment

Your email address will not be published. Required fields are marked *

GradeEssays.com
We are GradeEssays.com, the best college essay writing service. We offer educational and research assistance to assist our customers in managing their academic work. At GradeEssays.com, we promise quality and 100% original essays written from scratch.
Contact Us

Enjoy 24/7 customer support for any queries or concerns you have.

Phone: +1 213 3772458

Email: support@gradeessays.com

© 2024 - GradeEssays.com. All rights reserved.

WE HAVE A GIFT FOR YOU!

15% OFF 🎁

Get 15% OFF on your order with us

Scroll to Top