Answered step by step
Verified Expert Solution
Link Copied!

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 straight-forward (e.g. 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 (e.g. 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 (e.g. 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. e.g. 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 comma-separated ingredients necessary to make that dish
o Spaces are permitted (for both the dish and the ingredients); simply take them as the whole term (e.g. Garlic Bread is a dish)
A line of precisely 10 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 ingredient(theres 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 1000 labels to keep track of.(i.e. once you get to dealing with the graph, you can assume an upper limit of 1000 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 user-specified 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.
image text in transcribed

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

Explain the strength of acid and alkali solutions with examples

Answered: 1 week ago

Question

Introduce and define metals and nonmetals and explain with examples

Answered: 1 week ago