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. You will start
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. You will start to implement a first version of a more complex class and create a test class to put it through its paces.
Go to the Start Here page and download the Stepping Stone code .zip for the starter code for this assignment.
To complete this assignment, review the following documents:
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. * */
,
Stepping Stone Lab Five Guidelines Recipe Class With Accessors and Mutators
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 lab is the point where we start to pull all the elements of the course together. You will start to implement a first version of the Recipe class and create a test class to put it through its paces.
Be sure to review the Stepping Stone Lab Five guidelines before beginning this lab. The completed code (.java file) from Stepping Stone Lab Four is included in this module to use as a reference for comparison of your work in Module Five as well as moving forward. This code serves a number of functions:
· It allows you to review your own submitted code.
· You may utilize it as a useful foundation for Stepping Stone Lab Five as well as other assignments to come.
· Together with instructor feedback on your submitted code, you are building your own final project application.
As you are developing the code in this stepping stone 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.
SteppingStone5_Recipe |
· recipeName: String · servings: int · recipeIngredients: ArrayList · totalRecipeCalories: double |
+ getRecipeName(): String + setRecipeName(String): void + getServings(): int + setServings(int): void + getRecipeIngredients(): ArrayList + setRecipeIngredients(ArrayList): void + getTotalRecipeCalories(): double + setTotalRecipeCalories(double): void + printRecipe(): void + addNewRecipe(): SteppingStone5_Recipe |
Prompt: In this stepping stone lab assignment, you will build a Recipe class, getting user input to collect the recipe name and serving size, using the ingredient entry code from Stepping Stone Lab Four to add ingredients to the recipe, and calculating the calories per serving. Additionally, you will build your first custom method to print the recipe to the screen.
Specifically, you will need to create the following:
· The instance variables for the class (recipeName, serving size, and recipeIngredients)
· The methods (the accessors/mutators, the constructors, and the extra print details method) for the class
· A custom method to print the recipe out to the console
*To test the functionality of your finished code, use the SteppingStone5_RecipeTest.java file
*Replace the public static void main(String[] args) with public SteppingStone5_Recipe createNewRecipe()
Guidelines for Submission: This assignment should be submitted as a Java file.
Extending This Lab for Your Final Project For your final project:
1. Modify this code to develop a Recipe class:
A. Change the void main method createNewRecipe() that returns a Recipe
2. FOR FINAL SUBMISSION ONLY:
Change the ArrayList type to an Ingredient object. When a user adds an ingredient to the recipe, instead of adding just the ingredient name, you will add the actual ingredient including name, amount, measurement type, and calories. For the Milestone Two submission, the recipeIngredients ArrayList can remain as a string type.
3. Adapt the printRecipe() method to print the amount and measurement type as well as the ingredient name.
4. Create a custom method in the Recipe class. Choose one of the following options:
A. Print out a recipe with amounts adjusted for a different number of servings.
B. Create an additional list or ArrayList that allows users to insert step-by-step recipe instructions.
C. Convert ingredient amounts from English to metric (or vice versa).
D. Calculate select nutritional information.
E. Calculate recipe cost.
F. Propose a suitable alternative to your instructor.
Development Tips
· To add accessors/mutators, choose Refactor → Encapsulate Fields.
· You can also insert constructors by going to Source → Insert Code.
· Finally, you can also prompt the user for the recipe information instead of hard-coding it.
image1.jpg
image2.jpg
,
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% |
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.