Question: Consider the following code: public class RecipeBook { private String name; private Map > recipes; public RecipeBook ( String name ) { this.name = name;

Consider the following code:
public class RecipeBook { private String name; private Map> recipes; public RecipeBook(String name){ this.name = name; this.recipes = new HashMap<>(); }// REQUIRES: recipeName is not already in recipes // MODIFIES: this // EFFECTS: adds recipeName to recipes, and assigns an empty list of ingredients public void addNewRecipe(String recipeName){ List ingredients = new ArrayList<>(); //BLANK 1}// REQUIRES: recipeName is in recipes // MODIFIES: this // EFFECTS: adds ingredient to recipeName's list of ingredients public void addToRecipe(String recipeName, String ingredient){ List ingredients = recipes.get(recipeName); //BLANK 2} public void printRecipes(){ System.out.println(this.recipes); }} public class Main { public static void main(String[] args){ RecipeBook grampasWings = new RecipeBook("Grampa's Wings"); grampasWings.addNewRecipe("hot wings"); grampasWings.addToRecipe("hot wings", "wings"); grampasWings.addToRecipe("hot wings", "spices"); grampasWings.printRecipes(); }}
Part 1
What goes in BLANK 1(select all that apply):
Checkbox options
(a)
values.add(ingredients);
(b)
recipes.put(recipeName,new ArrayList<>())
(c)
values = recipes.get(recipeName);
(d)
values = recipes.get(recipeName);
(e)
recipes.add(recipeName)
(f)
values = ingredients;
(g)
recipes.put(recipeName, ingredients)
Select all possible options that apply.

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