Question: (in Java) In this exercise, we will create two distinct classes, a Meal and a Chef. A Meal consists of three attributes - a name,

 (in Java) In this exercise, we will create two distinct classes,

(in Java)

In this exercise, we will create two distinct classes, a Meal and a Chef. A Meal consists of three attributes - a name, the number of calories in the meal, and a recipe. The Meal class should include getter methods for all instance variables, and a tostring that provides the name and the number of calories that make up the meal. For example, the tostring for the meal Meal toast = new Meal("Toast", 100, "Put in toaster for 3 mins"); would return: Toast, which has 100 calories." The Chef class also has three instance variables - the chef's name, the name of the restaurant they work at, and their best meal. Their best meal should be a Meal object. The Chef class should have getter methods for all instance variables, as well as getter methods for each instance variable of their meal. For example, their should be a getMealRecipe, getmealcalories and getMealName getter methods to access information about the meal. The Chef class should also have a tostring that when printed returns the name of the chef, the restaurant they work at, and the meal that they are best known for: Chef Karel works at Chuck E cheese and is best known for Toast, which has 100 calories

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