Question: Objective: Check which recipes can be made with a given amount of ingredients. Input Data Files - Grocies.txt (A list of the ingredients you have
Objective:
Check which recipes can be made with a given amount of ingredients.
Input Data Files
- Grocies.txt (A list of the ingredients you have available to cook with).
- Recipe.txtr (Multiple recipe files numbers 1,2,3 etc.) (The first line in the file is the name of the recipe followed by the ingredients that are needed and what quantity is needed)
Classes to Create
You must create at least three classes:
- Project.java (Your main class where you read in the data files, populate the pantry, check the recipes, and output to the screen)
- Pantry.java (Your Pantry class to hold all the available ingredient object)
-Must have an "add" method for adding an ingredient object
-Must have a "getQuality" method that takes a name of an ingredient as an input and returns the quantity of that ingredient available in the pantry.
-Must use the bult-in Java LinkedList class to hold the ingredient objects
-Ingredient.java (A Class to represent a single ingredient
- Should have at least "name" and "quantity" fields.
Flow of the Main Method:
1.) Create an instance of your Pantry Class
2.) Read in the Grocreies.txt file, create Ingredient objects for each item and add them to the pantry object.
3.) Read each Recipe.txt file (using a loop) and determine whether or not that recipe can be made with the available ingredients in the Pantry. (Each recipe is independent.)
4.) Write to screen which recipes can be made and which recipes cannot be.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
