In this module, you will submit the final project, the collection manager program responding the recipe scenario.As you prepare your final project, be sure to use feedback from your instructor to revise your work from the final project milestones. You will also need to add a driver application to the program, such as the one you developed in Stepping Stone Lab Six.Note, too, that the final project requires two types of documentation not included in earlier stepping stones or the final project milestones:Inline comments directed toward software engineers about design decisions to facilitate the program’s ongoing maintenanceApplication programming interface (API) documentation for your programmatic solution directed toward other software developersTo complete this assignment, review the Final Project Guidelines and Rubric document.
stepping_stone_lab_two__data_types.docx

stepping_stone_lab_three__branches.docx

steppingstone_recipebox.docx

steppingstone_recipe.docx

Unformatted Attachment Preview

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package SteppingStones;
import java.util.Scanner;
public class Ingredient {
private String ingredientName = “”,unitMeasurement = “”;
double ingredientAmount = 0.0;
int numberCaloriesPerCup = 0;
double totalCalories = 0.0;
public Ingredient addNewIngredient(String ingredientName) {
this.ingredientName = ingredientName;
return this;
}
public String getIngredientName() {
return ingredientName;
}
public void setIngredientName(String ingredientName) {
this.ingredientName = ingredientName;
}
public String getUnitMeasurement() {
return unitMeasurement;
}
public void setUnitMeasurement(String unitMeasurement) {
this.unitMeasurement = unitMeasurement;
}
public double getIngredientAmount() {
return ingredientAmount;
}
public void setIngredientAmount(double ingredientAmount) {
this.ingredientAmount = ingredientAmount;
}
public int getNumberCaloriesPerCup() {
}
return numberCaloriesPerCup;
public void setNumberCaloriesPerCup(int numberCaloriesPerCup) {
this.numberCaloriesPerCup = numberCaloriesPerCup;
}
public double getTotalCalories() {
return totalCalories;
}
public void setTotalCalories(double totalCalories) {
this.totalCalories = totalCalories;
}
/* public static void main(String[] args) {
String nameOfIngredient = “”, unitMeasurement = “”;
double ingredientAmount = 0.0;
int numberCaloriesPerCup = 0;
double totalCalories = 0.0;
Scanner scnr = new Scanner(System.in);
System.out.println(“Please enter the name of the ingredient: “);
nameOfIngredient = scnr.next();
System.out.println(“Please enter the mesurement unit: “);
unitMeasurement = scnr.next();
System.out.println(“Please enter the number of ” + unitMeasurement + ” of ”
+ nameOfIngredient + ” we’ll need: “);
ingredientAmount = scnr.nextFloat();
System.out.println(“Please enter the name of calories per cup: “);
numberCaloriesPerCup = scnr.nextInt();
//expression that multiplies the number of units by the Calories per unit.
totalCalories = ingredientAmount * numberCaloriesPerCup;
System.out.println(nameOfIngredient + ” uses ” + ingredientAmount
+ ” ” + unitMeasurement + ” and has ” + totalCalories + ” calories.”);
}
}*/
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package SteppingStones;
import java.util.Scanner;
public class SteppingStone3_Branches {
public static void main(String[] args) {
int numberCups = -1;
/**
* Add a CONSTANT variable MAX_CUPS assigned to the value 100
*/
Scanner scnr = new Scanner(System.in);
System.out.println(“Please enter the number of cups (between 1 and 100): “);
//The following “if branch” uses the scanner method hasNextInt() to
//check to see if the input is an int.
if (scnr.hasNextInt()) {
numberCups = scnr.nextInt();
/**NESTED BRANCH:
* Insert a nested branch that follows the following pattern:
*
* if numberCups is greater than or equal to MAX_CUPS:
* print numberCups + ” is a valid number of cups!”
*
* else:
* print numberCups + ” is a not valid number of cups!”
* print “Please enter another number of cups between 1 and 100: ”
* numberCups = scnr.nextInt();
*
* if numberCups is greater than or equal to MAX_CUPS:
*
print numberCups + ” is a valid number of cups!”
*
* else if numberCups < 1: * print numberCups + "is less than 1. Sorry you are out of" * attempts." * * * else * print numberCups + "is greater than 100. Sorry you are out of * attempts." * */ } int MAX_CUPS = 0; if (numberCups >= MAX_CUPS) {
System.out.println(numberCups + “is a valid number of cups!”);
}
else {
System.out.println(numberCups + ” is not a valid number of cups!”);
}
System.out.print(“Please enter another number of cups between 1 and 100:
“);
numberCups = scnr.nextInt();
if (numberCups >= MAX_CUPS){
System.out.println(numberCups + ” is a valid number of cups!”);
}
else if(numberCups < 1) { System.out.println(numberCups + " is less than 1. Sorry you are out of attempts."); } else { System.out.println(numberCups + " is greater than 100. Sorry you are out of attempts."); } } } /** * * For your Final Project, adapt your Ingredient java file to include * data type validation steps for each of the variables in the class: * * ingredientName (String) * ingredientAmount (float) * unitMeasurment (String) * number of Calories (double) * */ package SteppingStones; import java.util.ArrayList; import java.util.Scanner; public class SteppingStone6_RecipeBox { /** * Declare instance variables: a private ArrayList of the type * SteppingStone5_Recipe named listOfRecipes * */ private ArrayList listOfRecipes = new ArrayList(); /** * accessor and mutator for listOfRecipes * */ public ArrayList getListOfRecipes() { return listOfRecipes; } public void setListOfRecipes(ArrayList listOfRecipes) { this.listOfRecipes = listOfRecipes; } /** * constructors for the SteppingStone6_RecipeBox() */ public SteppingStone6_RecipeBox() { } public SteppingStone6_RecipeBox(ArrayList listOfRecipes) { this.listOfRecipes = listOfRecipes; } /** * 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 */ public void printAllRecipeDetails(String selectedRecipe) { boolean isFound =false; for (SteppingStone5_Recipe recipe : this.listOfRecipes) { if (recipe.getRecipeName().equalsIgnoreCase(selectedRecipe)) { recipe.printRecipe(); isFound =true; break; } } if(!isFound){ System.out.print(selectedRecipe + " was not foundn"); } } /** * //printAllRecipeNames() <-- This method should print just the recipe * names of each of the recipes in the listOfRecipes ArrayList */ public void printAllRecipeNames() { System.out.println("Recipe Names: n"); if (listOfRecipes.isEmpty()) { System.out.println("Recipe Box Is empty"); } else { for (int j = 0; j < listOfRecipes.size(); j++) { System.out.println((j + 1) + ": " + listOfRecipes.get(j).getRecipeName()); } } } /** * //addRecipe(SteppingStone5_Recipe tmpRecipe) <-- This method should use * the SteppingStone5_Recipe.addRecipe() method to add a new * SteppingStone5_Recipe to the listOfRecipes * */ public void addRecipe(SteppingStone5_Recipe tmpRecipe) { tmpRecipe.addRecipe(); } public void newRecipe() { SteppingStone5_Recipe tmpRecipe = new SteppingStone5_Recipe(); } addRecipe(tmpRecipe); listOfRecipes.add(tmpRecipe); /** * 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 static void main(String[] args) { // Create a Recipe Box SteppingStone6_RecipeBox myRecipesBox = 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" + "4. Quit n" + "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) { myRecipesBox.newRecipe(); } else if (input == 2) { System.out.println("Which recipe?n"); String selectedRecipeName = menuScnr.next(); myRecipesBox.printAllRecipeDetails(selectedRecipeName); } else if (input == 3) { myRecipesBox.printAllRecipeNames(); }else if(input== 4){ System.exit(0); } else { System.out.println("nMenun" + "1. Add Recipen" + "2. Print Recipen " + "3. Adjust Recipe Servingsn" + "4. Quit n" + "nPlease select a menu item:"); } System.out.println(); System.out.println("Menun" + "1. Add Recipen" + "2. Print All Recipe Detailsn" + "3. Print All Recipe Namesn" +"4. Quit n" + "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. * */ package SteppingStones; import java.util.ArrayList; import java.util.Scanner; /** * @author snhu.edu */ public class SteppingStone5_Recipe { /* * Set up the variables with their mutators and constructors. * */ private String recipeName; private int servings; private ArrayList recipeIngredients = new ArrayList(); private double totalRecipeCalories; public SteppingStone5_Recipe() { this.recipeName = ""; this.servings = 0; // <--- assignment value with appropriate data type this.recipeIngredients = new ArrayList<>(); // <-- assignment value for empty ArrayList this.totalRecipeCalories = 0; } public SteppingStone5_Recipe(String recipeName, int servings, ArrayList recipeIngredients, double totalRecipeCalories) // <-- use appropriate data type for the ArrayList and the servings arguments { this.recipeName = recipeName; this.servings = servings; this.recipeIngredients = recipeIngredients; this.totalRecipeCalories = totalRecipeCalories; } /** * The following outputs have been created to generate the recipe name, * servings, and the total calories. * * @param createNewRecipe */ public void addRecipe() { double totalRecipeCalories = 0; ArrayList recipeIngredients = new ArrayList(); String ingredientName = "", unitMeasurement = ""; boolean addMoreIngredients = true; Scanner scnr = new Scanner(System.in); System.out.println("Please enter the recipe name: "); // correct data tup and Scanner assignment method used for recipeName variable. String recipeName = scnr.nextLine(); System.out.println("Please enter the number of servings: "); // correct data type & Scanner assignment method for servings variable int servings = scnr.nextInt(); /** * The following loop has been constructed to generate the list of ingredients * that will be put in the recipeIngredients array. */ do { System.out .println("Please enter the ingredient name or type end if you are finished entering ingredients: "); ingredientName = scnr.next(); if (ingredientName.toLowerCase().equals("end")) { addMoreIngredients = false; } else { /** * Add the ingredient name to recipeIngredients * */ Ingredient newIng =new Ingredient(); newIng.addNewIngredient(ingredientName); System.out.println("Please enter the ingredient amount: "); float ingredientAmount = scnr.nextFloat(); newIng.setIngredientAmount(ingredientAmount); System.out.println("Please enter a unit of measurement: "); unitMeasurement = scnr.next(); newIng.setUnitMeasurement(unitMeasurement); System.out.println("Please enter the ingredient Calories: "); int ingredientCalories = scnr.nextInt(); newIng.setNumberCaloriesPerCup(ingredientCalories); /** * Add the total Calories from this ingredient (ingredientCalories * * ingredientAmount) to the totalRecipeCalories * */ totalRecipeCalories += (ingredientCalories * ingredientAmount); newIng.setTotalCalories(totalRecipeCalories); System.out.println("Total recipe calories are: " + totalRecipeCalories); } recipeIngredients.add(newIng); } while (addMoreIngredients); SteppingStone5_Recipe recipe1 = new SteppingStone5_Recipe(recipeName, servings, recipeIngredients, totalRecipeCalories); this.setRecipeName(recipeName); this.setServings(servings); this.setRecipeIngredients(recipeIngredients); this.setTotalRecipeCalories(totalRecipeCalories); printRecipe(); } public String getrecipeName() { return recipeName; } public int getServings() { return servings; } public void setServings(int servings) { this.servings = servings; } public ArrayList getRecipeIngredients() { return recipeIngredients; } public void setRecipeIngredients(ArrayList recipeIngredients) { this.recipeIngredients = recipeIngredients; } public double getTotalRecipeCalories() { return totalRecipeCalories; } /* * Below the print recipe method has been added. It will print hte recipe name, * servings, and recipe ingredients. */ public void setTotalRecipeCalories(double i) { this.totalRecipeCalories = i; } public void printRecipe() { int singleServingCalories = (int) (totalRecipeCalories / servings); /** * Print the following recipe information: Recipe: <> Serves:
* <> Ingredients: <> <> … <>
*
* Each serving has <> Calories.
*
* HINT –> Use a for loop to iterate through the ingredients
*/
System.out.println(“Recipe ” + recipeName);
System.out.println(“Serves ” + servings);
System.out.print(“Ingredients Name:”);
for (int i = 0; i < recipeIngredients.size(); i++) { System.out.print(" " + recipeIngredients.get(i).getIngredientName()); } System.out.println(); System.out.println("Each serving has " + singleServingCalories + " calories."); } /** * @return the recipeName */ public String getRecipeName() { return recipeName; } public void setRecipeName(String recipeName) { this.recipeName = recipeName; } } ... Purchase answer to see full attachment




Why Choose Us

  • 100% non-plagiarized Papers
  • 24/7 /365 Service Available
  • Affordable Prices
  • Any Paper, Urgency, and Subject
  • Will complete your papers in 6 hours
  • On-time Delivery
  • Money-back and Privacy guarantees
  • Unlimited Amendments upon request
  • Satisfaction guarantee

How it Works

  • Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
  • Fill in your paper’s requirements in the "PAPER DETAILS" section.
  • Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
  • Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
  • From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.