Answered step by step
Verified Expert Solution
Question
1 Approved Answer
New + Save Meal.java Chef Tester.java Chef.java 5.4.8 A Chef's Best Meal Submit + Continue Output Test Cases C Docs Assignment Grada Mora 1 public
New + Save Meal.java Chef Tester.java Chef.java 5.4.8 A Chef's Best Meal Submit + Continue Output Test Cases C Docs Assignment Grada Mora 1 public class ChefTester 6 points Status: Not Submitted 2. { 3 public static void main(String[] args) In this exercise, we will create two distinct classes, a Meal and a Chef. 4 - { 5 5 A Meal consists of three attributes - a name, what course the meal falls // Don't modify this part! 6 Meal macaroni = new Meal("Mac N Cheese", "Lunch", 8); under, and the number of servings in the meal. The Meal class should 7 Chef alex = new Chef("Alex", "Juniors Cheesecake", macaroni) Include getter methods for all Instance variables/e.g. getName, getCourse, 8 and getNumberOfServings), and a toString that provides the name and 9 System.out.println(alex); 10 System.out.println(alex.getMealName(); the course of the meal. For example, the toString for the meal 11 Meal toast = new Meal("Toast", "Breakfast", 1); would return: 12 // Create your own Meal and Chef here: Toast (Breakfast) 13 } 14 } The Chef class also has three instance variables - the chef's name, the name 15 of the restaurant they work at, and their best meal. Their best meal should be a Meal object WHHH The Chef class should have getter methods for all instance variables, as well os getter methods for each instance voriable of their meal. For example, there should be a getHealName, getMeal Course and getMealServings 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 CBreakfast) There is a Meal and Chef already prepared for you in the ChefTester class. Add another meal and chef and print them to the console. Be sure to test all of your accessor methods, too
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