You do not need to write any of the other clases for the milestone.
When any of the Ingredient classes print its recipe, it first prints a header containing its name between two lines of equal signs.
## Objectives * Translate UML class diagrams into source code * Construct software using an interface * Employ aggregation and composition in the development of software ## Assignment In this lab, we will explore using interfaces to make deserts. By using interfaces, we can treat prepared ingredients the same as the basic (simple) ones. There are three preparation techniques provided in this lab: (1) baking (2) measuring and (3) mixing. Every ingredient, simple or prepared, provides basic information about itself: * The ingredient's name * The energy content in Calories (kcal) * The volume of the ingredient * A recipe for preparing the ingredient Preparation techniques use existing ingredients to create new ones. ## Assignment Details A class diagram for the program is shown in the figure below: Implement all of the classes shown in the diagram above based on the discussion that follows. The arrows with black diamonds simply indicate that one class has a reference to another. These references are also shown as member variables in the class diagrams for the three prepared ingredients (Measure, BakedIngredient, and Mix) Simple ingredients print a simple recipe listing the name of the ingredients in the title (between two lines of equal signs) and the basic information about the ingredient. For example, the SimpleIngredient milk prints this recipe: ``` ==================================================== Milk ==================================================== Cups: 1 Cups Energy: 103 Calories ``` Energy is rounded to the nearest Calorie, and volume is rounded to the hundredth of a Cup. If fractional digits are zero, they are ommited as shown here. A baked ingredient keeps the same number of calories, but becomes dry and increases its volume by a user-provided expansion factor. (The new volume is $ \mathrm{EXPANSION\\_{FACTOR}} \times volume $ where $ volume $ is the volume of the `bakedIngredient`.) A measured ingredient maintains the energy density of the original ingredient, but measures a different quantity of it. The new quantity becomes part of the ingredient's name. The new volume is specified as $ numerator / denominator $ cups, where the denominator defaults to 1 if it is not provided. The calories are given by $ numerator / denominator \times energy / volume $ where the $ energy $ and $ volume $ describe the original ingredient. When printing its ingredient list, the measured ingredient lists the quantity both as a fraction and then, in parenthesis, as a decimal number to the nearest hundredth. See the cake output at the end for examples. A mixed ingredient is a combination of several existing ingredients. The volume and energy of the mix are simply the sum of the volume and energy of each of the ingredients in the mix, respectively. (This is a bit of an approximation, especially for volume!) A mix is wet if any of the ingredients is wet. A mixed ingredient's recipe lists the dry and wet ingredients separately, as shown in the ```ice cream``` example a little later on. Each prepared ingredient (baked, measured, and mixed) prints its own recipe and the recipe for each ingredient it is prepared from. For example, the ```dry milk``` option of the Kitchen program prints the recipe for baked milk, which in turn prints the recipe for the milk it is baked from: ``` ==================================================== Baked Milk ==================================================== Ingredient to be baked: Milk Cups: 0.2 Cups Energy: 103 Calories ==================================================== Milk ==================================================== Cups: 1 Cups Energy: 103 Calories ``` Similarly, ```ice cream``` prints first the main recipe, and then the recipe for each ingredient it is made from: ``` ==================================================== Ice Cream ==================================================== Dry Ingredients: Sugar Wet Ingredients: Cream Milk Cups: 2.12 Cups Energy: 980 Calories ==================================================== Cream ==================================================== Cups: 0.12 Cups Energy: 104 Calories ==================================================== Milk ==================================================== Cups: 1 Cups Energy: 103 Calories ==================================================== Sugar ==================================================== Cups: 1 Cups Energy: 773 Calories ``` A prepared ingredient may be used to prepare further ingredients. For example, in the cookie recipe, each ingredient in the mix is itself a measured ingredient: The final recipe is for a cake. The frosting and batter are prepared separately, and then combined: You may add new options to the example program, but do not edit the options provided in the example. Let the single `printRecipe()` call print everything. ## Appendix: cookie and cake examples. Here is the output for the two remaining options of [Kitchen.java](lab3res/Kitchen.java) * [cookies](lab3res/cookies.txt) * [cake](lab3res/cake.txt) ## Submission Instructions for Dr. Yoder Please submit the lab through [esubmit](http://esubmit.msoe.edu). See [Lab 1](Lab1) for instructions for accessing esubmit from off-campus.You will upload:
- Your individual .java files
—and— - A README.md file with an informal report (see below)
If you are submiting a draft submission to esubmit (especially near or after the deadline), please include the empty file DONOTGRADE.txt (in big bold capital letters, just like that!) so that I don't start grading something until you intend it to be complete. You can continue making submissions which will be counted as on-time until the deadline or a few minutes after.
Please use the template below for your README.md file. If you create the file from within IntelliJ by right-clicking on your source folder and selecting "new->file", you can just type in README.md, and it will even interpret the markdown for you!
## Introduction [Replace this line with a description of the lab in your own words] ## Conclusion [Replace this line with a description of what you learned in this lab] ## Things I Liked / Suggestions for Improvement [Replace this line with what you liked or think could be improved about the lab. (Required.)]Esubmit will run your code and check your output against the examples given in the lab. Although your output does not need to exactly match the output on esubmit, please make it close and consider whether differences are relavent. For example, a different number of equal signs on the lines does not matter, but making things singular that should be plural and vice-versa could. Exercise your own discression in evaluating these differences. If you see any of the following errors, please resubmit your lab. (You may submit multiple times before the deadline.) If you see this: Please upload your individual .java files, not a zip file. If you see this: Please upload [Kitchen.java](lab3res/Kitchen.java) as your main file, without modification (except to the package or to add your own recipes). If you see this: Please fix the compile error and upload your code again. Note that warnings may be considered compile errors. Please check IntellIJ for the yellow warning messages and correct them. If your output matches the expected output exactly, you will not see any output, but you will see a message stating that the code compiled successfully (and none of the errors above!)