Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Homework - create the start to a cookbook using Java Create a class named RecipeFactory public static Recipe makeRecipe(String recipeType, String recipeName, HashMap ingredients) public
Homework - create the start to a cookbook using Java
- Create a class named RecipeFactory
- public static Recipe makeRecipe(String recipeType, String recipeName, HashMap
ingredients) - public static final String (DESSERT and DINNER)
- Dessert and Dinner
- public static Recipe makeRecipe(String recipeType, String recipeName, HashMap
- Create an abstract class named Recipe
- protected HashMap
ingredients - Key: ingredient name
- Value: ingredient amount
- protected String name
- HashMap
getIngredients() - Can implement here
- String getName()
- Can implement here
- protected HashMap
- Extend your abstract class in DessertRecipe and DinnerRecipe
- Override toString
- Expected output below in Sample Cake Output
- Use the StringBuilder class
- Implement a constructor that takes String name and HashMap
ingredients. - Warning: assigning HashMap from constructor and memory
- new HashMap
(hashMap)
- new HashMap
- Override toString
- Sample Cake Output
- Hint: use to add a newline and \t to add the tab
- Since this will go through an autograder, you must exactly match the formatting (do not add an extra to the very end)
- Hint: use to add a newline and \t to add the tab
- Create a singleton class named Cookbook
- private Cookbook() { }
- private ArrayList
recipes - void addRecipe(Recipe r)
- void clearRecipes()
- ArrayList
getRecipes() - Cookbook getInstance()
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