Question: 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
  • 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
  • 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)
  • 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)

Homework - create the start to a cookbook using Java Create a

  • Create a singleton class named Cookbook
    • private Cookbook() { }
    • private ArrayList recipes
    • void addRecipe(Recipe r)
    • void clearRecipes()
    • ArrayList getRecipes()
    • Cookbook getInstance()

Name: Cake Food Type: Dessert 3/4 cups milk 2/3 cups sugar 3/4 cups flour 1 tsp vanilla

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!