Question: Create the following new Java classes, in the default package: ( Use these names exactly! ) Restaurant . javaDish.java - This will be an interfaceAppetizer.java
Create the following new Java classes, in the default package: Use these names exactly!RestaurantjavaDish.java This will be an interfaceAppetizer.java This will be an abstract class, of types of DishMainCourse.java This will be an abstract class, of types of DishDessert.java This will be an abstract class, of types of DishSalad.java This will be a class, of types of AppetizerSoup.java This will be a class, of types of AppetizerSteak.java This will be a class, of types of MainCoursePasta.java This will be a class, of types of MainCourseCake.java This will be a class, of types of DessertIceCream.java This will be a class, of types of DessertThe relationships between these classes are as follows:A Restaurant contains hasa Dishes.There are types of isa Dishes: Appetizers, Main Courses, and Desserts.Salad and Soup are types of Appetizer.Steak and Pasta are types of Main Course.Cake and IceCream are types of Dessert.Restaurant.javaThis class will represent a Restaurant object, which we will define as having:A name, represented as a String eg "Gusteau's"A max count of dishes on the menu, represented as an int eg in Labjava, the count is set to Dishes stored as an array of Dish objects eg DishA constructor that initializes all instance variables, and any other constructors as neededAn addDish method, which takes a Dish object as a parameter and returns nothingA toString method, which calls upon the toString method in Dish.java to return all needed information as a String see the output belowGetters and setters for all variablesDish.javaThis class will represent a Dish, defined as an interface. This interface should declare the following methods for the subclasses to implement:A method isVegetarian which takes no parameters and returns a boolean indicating whether or not the dish is vegetarianA getName method, which takes no parameters and returns a String of the dishs name eg "Caesar Salad"A getType method, which takes no parameters and returns a String of the dishs type eg "Appetizer"A toString method, which returns a String representation of the dish see the output belowAppetizerjava, MainCourse.java, Dessert.javaThese classes will be abstract representing the types of dishes on the menu. Each class should implement the Dish interface and have:A name, represented as a String eg "Lobster Bisque"Whether or not the dish is vegetarian, represented as a boolean eg false for SteakA constructor that initializes all instance variables, and any other constructors as neededA toString method, which returns a String representation of the dish by calling upon "getter" methodsA getType method, fulfilling the requirements of the super classAn abstract method getSubType which takes no parameters and returns a subtype of dish eg "Salad" Salad.java, Soup.java, Steak.java, Pasta.java, Cake.java, IceCream.javaThese classes will be concise, representing the specific types of dishes that can be added to the menu. Each class should extend its respective abstract class and have:A constructor that initializes all instance variables, and any other constructors as neededA getSubType method that fulfills the requirements of the super classSample Output:Welcome to Gusteau's Restaurant! Appetizer: Salad named Caesar Salad vegetarian Appetizer: Soup named Lobster Bisque not vegetarian Main Course: Steak named Ribeye Steak not vegetarian Main Course: Pasta named Fettuccine Alfredo vegetarian Dessert: Cake named Chocolate Cake vegetarian Dessert: Ice Cream named Vanilla Ice Cream vegetarian
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
