Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

  • 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

Students also viewed these Databases questions

Question

Was the Calcu-Folio properly classified as a briefcase or a binder?

Answered: 1 week ago

Question

Whal is the difference between a group a d n a team?

Answered: 1 week ago

Question

OSAGE businesscases

Answered: 1 week ago