In the last stepping stone lab for this course, you will create a test application by writing a RecipeBox driver application. This class should create a menu and let users execute the various operations defined for your classes.
To complete this assignment, review the following documents:
Stepping Stone Lab Six Guidelines RecipeBox Driver Application
Overview: Now that you have some experience building basic, single-class applications, here is an opportunity to delve into making a full-fledged application with more than one class. This stepping stone is the point where we pull all the elements of the course into a single Recipe Manager application.
The completed code (.java file) from Stepping Stone Lab Five is included in this module to use as a reference for comparison of your work in Module Six as well as moving forward.
The SteppingStone6_RecipeBox code provided is built around the variable and class names used throughout the stepping stone labs. As you are developing the code in this lab, you should consider how you can transition it to your final project. Eventually, the user input for collecting the ingredients into an ArrayList of strings will be converted to an ArrayList of Ingredient objects. Think about the variable names you are using and where in the code you are collecting the ingredient input.
SteppingStone6_RecipeBox |
– listOfRecipes: ArrayList |
+ getListOfRecipes(): ArrayList + setListOfRecipes(ArrayList): void + SteppingStone6_RecipeBox(): void + SteppingStone6_RecipeBox(ArrayList): void + printAllRecipeDetails(String): void + printAllRecipeNames(): void + addNewRecipe(): void |
Prompt: In Stepping Stone Lab Five, you created a Recipe Class. Now, in Stepping Stone Lab Six, you will focus your skills on developing your own driver class including custom methods to access elements of the Ingredient and Recipe classes.
Specifically, you will need to create the following:
· The instance variables for the class (listOfRecipes)
· Accessors and mutators for the instance variable
· Constructors
· Three custom methods: printAllRecipeDetails(), printAllRecipeNames, and addNewRecipe
Guidelines for Submission: This assignment should be submitted as a Java file.
Extending This Lab for Your Final Project
For your final project submission, you should add a menu item and a method to access the custom method you developed for the Recipe class based on the Stepping Stone Lab Five.
,
Stepping Stone Labs Two Through Six Guidelines and Rubric
Overview
· Beginning with Stepping Stone Two in Module Three, you will complete a series of related stepping stone labs that will help you build object-oriented programming skills that relate to your final project. Be sure to incorporate feedback from your instructor as you develop your work through the stepping stone labs and develop your final project.
· Note that Stepping Stone Lab One: Pseudocode is graded with a separate rubric.
Stepping Stone Labs Two through Six specifics:
Stepping Stone |
Module |
Title/Topic |
Task Specifics |
Two |
Three |
Data Types |
Produce basic data types for a recipe manager program. |
Three |
Four |
Validating Input With Branches |
Develop a branched structure for a recipe manager program. |
Four |
Five |
Entering Ingredients With Loops |
Develop iterative loops for a recipe manager program. |
Five |
Six |
Collection and Item Class With Accessors and Mutators |
Develop the first version of the Recipe class and create a test class. |
Six |
Eight |
The RecipeBox Driver Application |
Produce a driver application for a recipe manager program. |
Each of your programming assignments includes two parts:
· Code file(s)
· Written reflection as text file or Word document
· The assignment parts are submitted together with the written submission and with the code as a file attachment.
Critical Elements
The following critical elements should be addressed in your project submission:
I. Code Reflection A brief explanation of the code, its purpose, and a brief discussion of your experience in developing it, including any issues that you encountered while completing the stepping stone and what approaches you took to solve them
II. Specifications Source code must meet its specifications as defined by the data and problem. However, this may require multiple attempts or iterations. You will be given credit for code that is well on its way to meeting specifications or solving the problem.
III. Correctness Source code must behave as desired. While correct code produces the correct output as defined by the data and problem, for the stepping stones you will receive credit for producing fully functioning code (producing no errors) that aligns with as many of the specifications as possible. Note: You should write your code in such a way that the submitted files execute, even if they do not produce the correct output.
IV. Readability Code needs to be readable to a knowledgeable programmer. In this course, readable code requires the following:
a. Consistent, appropriate white space (blank lines, spaces) and indentation to separate, distinct parts of the code and operations
b. Explicit, consistent variable names that clearly indicate the data they hold and are formatted consistently
c. Organized structure—clear design separating components with different responsibilities
V. Annotation All code should also be well-commented. This is a practiced “art” that requires striking a balance between commenting everything, which adds a great deal of unneeded noise to the code, and commenting nothing. Well-annotated code requires you to do the following:
a. Explain the purpose of lines or sections of your code, detailing the approach and method you took to achieve a specific task in the code.
b. Document any section of code that is producing errors or incorrect results.
c. Your assignment should be submitted as a zip file of the exported code and reflection text, as required.
d. Note that, although the stepping stone labs are graded, their main purpose is to provide useful practice and feedback that you can incorporate as you build the knowledge and skills you need to succeed in the final project.
Stepping Stone Labs Two Through Six Rubric
Criteria |
Proficient (100%) |
Needs Improvement (70%) |
Not Evident (0%) |
Value |
Code Reflection |
Describes purpose of the code, techniques implemented to solve the problem, challenges encountered, and the approaches to overcome the challenges |
Lacks details of code purpose, techniques implemented, or challenges encountered |
Does not describe purpose of code, techniques used, or challenges encountered |
20 |
Code Requirements |
All or most algorithm specifications are fully met |
Details of the specifications are not met in significant instances |
The program does not meet the specifications |
20 |
Code Correctness |
The program functions as designed in most cases |
The program functions as designed in limited cases |
The program does not function as designed |
20 |
Code Readability |
Code follows proper syntax and demonstrates deliberate attention to spacing, white space, and variable naming |
Code contains variations from established syntax and conventions |
Code exhibits consistent and significant variations from established syntax and conventions |
20 |
Annotation |
Code annotations explain and facilitate navigation of the code |
Code annotations are incomplete or provide insufficient assistance with understanding the code |
Code annotations do not explain the code, do not facilitate navigation of the code, or are not present |
20 |
Total: |
100% |
,
package SteppingStones; import java.util.ArrayList; public class SteppingStone6_RecipeBox { /** * Declare instance variables: * a private ArrayList of the type SteppingStone5_Recipe named listOfRecipes * */ /** * Add accessor and mutator for listOfRecipes * */ /** * Add constructors for the SteppingStone6_RecipeBox() * */ /** * Add the following custom methods: * * //printAllRecipeDetails(SteppingStone5_Recipe selectedRecipe) * This method should accept a recipe from the listOfRecipes ArrayList * recipeName and use the SteppingStone5_Recipe.printRecipe() method * to print the recipe * * //printAllRecipeNames() <– This method should print just the recipe * names of each of the recipes in the listOfRecipes ArrayList * * //addRecipe(SteppingStone5_Recipe tmpRecipe) <– This method should use * the SteppingStone5_Recipe.addRecipe() method to add a new * SteppingStone5_Recipe to the listOfRecipes * */ /** * A variation of following menu method should be used as the actual main * once you are ready to submit your final application. For this * submission and for using it to do stand-alone tests, replace the * public void menu() with the standard * public static main(String[] args) * method * */ public void menu() { // Create a Recipe Box //SteppingStone6_RecipeBox myRecipeBox = new SteppingStone6_RecipeBox(); //Uncomment for main method Scanner menuScnr = new Scanner(System.in); /** * Print a menu for the user to select one of the three options: * */ System.out.println("Menun" + "1. Add Recipen" + "2. Print All Recipe Detailsn" + "3. Print All Recipe Namesn" + "nPlease select a menu item:"); while (menuScnr.hasNextInt() || menuScnr.hasNextLine()) { System.out.println("Menun" + "1. Add Recipen" + "2. Print All Recipe Detailsn" + "3. Print All Recipe Namesn" + "nPlease select a menu item:"); int input = menuScnr.nextInt(); /** * The code below has two variations: * 1. Code used with the SteppingStone6_RecipeBox_tester. * 2. Code used with the public static main() method * * One of the sections should be commented out depending on the use. */ /** * This could should remain uncommented when using the * SteppingStone6_RecipeBox_tester. * * Comment out this section when using the * public static main() method */ if (input == 1) { newRecipe(); } else if (input == 2) { System.out.println("Which recipe?n"); String selectedRecipeName = menuScnr.next(); printAllRecipeDetails(selectedRecipeName); } else if (input == 3) { for (int j = 0; j < listOfRecipes.size(); j++) { System.out.println((j + 1) + ": " + listOfRecipes.get(j).getRecipeName()); } } else { System.out.println("nMenun" + "1. Add Recipen" + "2. Print Recipen" + "3. Adjust Recipe Servingsn" + "nPlease select a menu item:"); } /** * This could should be uncommented when using the * public static main() method * * Comment out this section when using the * SteppingStone6_RecipeBox_tester. * if (input == 1) { myRecipeBox.newRecipe(); } else if (input == 2) { System.out.println("Which recipe?n"); String selectedRecipeName = menuScnr.next(); myRecipesBox.printAllRecipeDetails(selectedRecipeName); } else if (input == 3) { for (int j = 0; j < myRecipesBox.listOfRecipes.size(); j++) { System.out.println((j + 1) + ": " + myRecipesBox.listOfRecipes.get(j).getRecipeName()); } } else { System.out.println("nMenun" + "1. Add Recipen" + "2. Print Recipen" + "3. Adjust Recipe Servingsn" + "nPlease select a menu item:"); } * */ System.out.println("Menun" + "1. Add Recipen" + "2. Print All Recipe Detailsn" + "3. Print All Recipe Namesn" + "nPlease select a menu item:"); } } } /** * * Final Project Details: * * For your final project submission, you should add a menu item and a method * to access the custom method you developed for the Recipe class * based on the Stepping Stone 5 Lab. * */