Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This assignment is the graphs assignment, and centres around either working out what dishes you could make based only on what s already in your
This assignment is the graphs assignment, and centres around either working out what dishes you could make based only on whats already in your pantry, generating a shopping list to know what youd need to pick up if you already have
the weeks meals planned out, or even just knowing what to set out in the kitchen before working on a single dish.
Of course, this could raise issues like some ingredients being both derivable and purchaseable, but luckily itll always be pretty straightforward eg if you only have salt butter, you dont need to buy salted butter; but nobody would ever
say oh I need salted butter and already have salt? I should totally buy the unsalted butter then!
The Task:
Again, this is the graphs assignment. This means youre creating a graph. More specifically, youre going to approach this using an adjacency list or matrix. However, youll need to be very careful about how you do so
Above, you can see part of one possible Cookbook: it is a graph that shows how myriad ingredients can be combined to form dishes. Ostensibly there are three different types of item:
Base ingredients eg Oil: You have them, or you dont Suitable for a shopping list, and might be found in your Pantry, or it might not be
Derivable ingredients eg Tomato Sauce: These are also something you might see on a shopping list, but if you
have all the Base ingredients or other derivable ingredients that lead to them, then you might still be able to make them so anything relying on them can also be made
Dishes: The only thing that distinguishes these from derivable ingredients is theyll never show up on the
shopping list. eg if you want Mac & Cheese, then youre only getting it if the Cheese Sauce and Noodles come from some combination of Pantry and shopping list.
The user will select a data file for the cookbook; you only need to worry about one for a given execution, but there could be several different ones in general. The format for the data file is as follows:
One line each for the dishes:
o First the name of the dish
o Then a tab character
o Then commaseparated ingredients necessary to make that dish
o Spaces are permitted for both the dish and the ingredients; simply take them as the whole term eg Garlic Bread is a dish
A line of precisely dashes:
One line each for the derivable ingredients that arent dishes:
o Same convention as for the dishes
The user will also select a data file for preloading the initial state of the Pantry. The data files format is trivial:
Each line is an ingredient
Its legal to be a base ingredient or a derivable ingredienttheres no need for a distinction
Note: there is no concept of quantity. For the purpose of this assignment, if you have eggs, you have eggs
It should be pretty obvious from the bold and Courier font, but the Cookbook and Pantry are separate classes from your main program. For the sake of simplicity, you are permitted to assume that, across all dishes and ingredients, there will never be more than labels to keep track ofie once you get to dealing with the graph, you can assume an upper limit of vertices, if you like
The program, after loading in the cookbook and pantry contents, must offer the user some basic options:
The ability to display everything that could be made, using the recipes in the cookbook
The ability to see all of the available options for dishes that could be made
The ability to see all dishes that could be made with the current stock in the Pantry o Note: this obviously includes taking advantage of recipes for derivable ingredients
The ability to see the contents of your Pantry
The ability to add more items to the Pantry
The ability to ask whether or not a userspecified dish can be made based on the Pantrys current stock
Creation of a shopping list:
o Based on a selection of desired dishes, as well as the current stock of the Pantry
o You will not purchase a derivable ingredient if you already have all components necessary to make it
o You will purchase a derivable ingredient if youre missing even one component as per the first page, if you have salt, but need salted butter, youre just going to buy some salted butter; not regular butter with the expectation of salting it But if you have salt and milk, then you can make salted butter
Display a listing for mise en place:
o Its just the thing where you get all the ingredients youre going to need ready in advance. In other words, based on a desired dish that you have the ingredients to make, in some form or another simply display them all.
This should be done in java and please do not youse arraylists or hashmaps. Please read the instructions carefully and rest of the instructions are in the attached picture.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started