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_2

Step: 3

blur-text-image_3

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

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

Explain strong and weak atoms with examples.

Answered: 1 week ago

Question

Explain the alkaline nature of aqueous solution of making soda.

Answered: 1 week ago

Question

Comment on the pH value of lattice solutions of salts.

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago