final project details for your final project submission youshould add a menu item an 5122669

Final Project Details: For your final project submission, youshould add a menu item and a method to access the custom method youdeveloped for the Recipe class based on the Stepping Stone 5 Lab.Here is the Recipe class code: package recipe.collection;

import java.util.ArrayList;

import java.util.Scanner; /**

*

* @author

*/

public class Recipe {

    private String recipeName;

    private int servings;

    private ArrayListrecipeIngredients;

    private double totalRecipeCalories;

  

    /**

     *

     */

    public Recipe() {

        this.recipeName =””;

        this.servings = 0;//

        this.recipeIngredients =new ArrayList(); //

        this.totalRecipeCalories= 0;

    }     /**

     *This is the recipe class and in thisclass the user can print the recipe and create a new recipe aswell.

     *When Printing the recipe the user willsee the Recipe name, the serving size, and the ingredients

     *When creating a new recipe the user isasked to name the recipe, how many servings the recipe yields, andthen they are asked to add

     *the ingredients one at a time. It isduring this process that the ingredient class is called.

     * @param args

     */

    public static void main(String[] args){

        Recipe r =createNewRecipe();//constructor to create new recipe

       r.printRecipe();//Accessor for the printRecipe() method

      

    }

    //     /**

     *constructor that retrieves the recipename

     * @return recipeName

     */

    public String getRecipeName() {

        return recipeName;

    }

    //     /**

     *mutator that sets the recipe name

     * @param recipeName

     */

    public void setRecipeName(StringrecipeName){

        this.recipeName =recipeName;

    }

    //     /**

     *constructor to retrieve the servingsize

     * @return serving

     */

    public int getServing() {

        return servings;

    }

    //     /**

     *mutator to set the serving size

     * @param serving size

     */

    public void setServing(int serving) {

        this.servings =serving;

    }     /**

     * calls the Array that holds the recipeingredients

     * @return recipe ingredients

     */

    public ArrayList getRecipeIngredients() {

        returnrecipeIngredients;

    }

    //     /**

     *sets the ingredients held by thearray

     * @param recipeIngredients

     */

    public void setRecipeIngredients(ArrayListrecipeIngredients){

        this.recipeIngredients =recipeIngredients;

    }

    //accessor that calls the total recipecalories     /**

     *

     * @return Total calories in therecipe

     */

    public double getTotalRecipeCalories(){

        returntotalRecipeCalories;

    }

    //mutator that sets the total recipecalories     /**

     *

     * @param totalRecipeCalories

     */

    public void setTotalRecipeCalories(doubletotalRecipeCalories){

        this.totalRecipeCalories= totalRecipeCalories;

    }

    //Recipe class     /**

     *

     * @param recipeName

     * @param servings

     * @param recipeIngredients

     * @param totalRecipeCalories

     */

    public Recipe(String recipeName, intservings,

    ArrayList recipeIngredients, doubletotalRecipeCalories)

    //

    {

        this.recipeName =recipeName;

        this.servings =servings;

        this.recipeIngredients =recipeIngredients;

        this.totalRecipeCalories= totalRecipeCalories;

    }     /**

     *

     */

    public void printRecipe() {

       //printRecipeWithDifferentServings(servings);

        doublesingleServingCalories = totalRecipeCalories / servings;

       System.out.println(“Recipe: ” + getRecipeName());

       System.out.println(“Yield: ” + getServing() + ” servings”);

       System.out.println(“Ingredients:”);

        for (int i = 0; i            Ingredient currentIngredient = recipeIngredients.get(i);

           String currentIngredientName =currentIngredient.getNameOfIngredient();

           System.out.println(currentIngredientName);

        }

        System.out.print(“.Eachserving has ” + singleServingCalories + ” calories”);

    }     /**

     *

     * @return recipe1

     */

    public static Recipe createNewRecipe(){

        doubletotalRecipeCalories = 0;

        ArrayListrecipeIngredients = new ArrayList();

        booleanaddMoreIngredients = true;

        String reply=”Y”;

        Scanner scnr = newScanner(System.in);

       System.out.println(“Please enter the recipe name: “);

        String recipeName =scnr.nextLine();

       System.out.println(“Please enter the number of servings: “);

       @SuppressWarnings(“LocalVariableHidesMemberVariable”)

        int servings =scnr.nextInt();         do {

           System.out.println(“Please enter the ingredient name or type end ifyou are finished entering ingredients: “);

           String ingredientName = scnr.next();

           if (ingredientName.toLowerCase().equals(“end”)) {

           addMoreIngredients = false;

           } else {

               Ingredient tempIngredient = new Ingredient().addIngredient();

               recipeIngredients.add(tempIngredient);

               System.out.println(“Please enter the ingredient amount: “);

               float ingredientAmount = scnr.nextFloat();

               System.out.println(“Please enter the ingredient Calories: “);

               int ingredientCalories = scnr.nextInt();

               totalRecipeCalories = ingredientCalories * ingredientAmount;

               System.out.println(“Do you want to continue. Y/N”);

               reply = scnr.nextLine();

           }

        } while(!reply.equals(“n”)) ;

           scnr.close();

           Recipe recipe1 = new Recipe(recipeName, servings,recipeIngredients, totalRecipeCalories);

           return recipe1;

    }

} Recipe Collection Box Code: package recipe.collection; import java.util.ArrayList;

import java.util.Scanner; /**

*This is a collection spot for all the recipes currently beingmaintain by the user.

* @author

*/

public class RecipeBox {

  

    private static ArrayList listOfRecipes;

   //Accessor Recipe Array     /**

     *Gathers the list of recipes and storesthem in an array

     * @return

     */

          publicArrayList getListOfRecipes(){

           return listOfRecipes;

          }

          //Mutatorfor Array List     /**

     *All of the recipes that are currentlybeing stored by the user are set with this mutator

     * @param listOfRecipes

     */

          public voidsetListOfRecipes(ArrayList listOfRecipes){

            this.listOfRecipes = listOfRecipes;

          }

        //Constructor for recipebox

   void RecipeBox(){

           listOfRecipes = new ArrayList();

        }

        void RecipeBox(ArrayListlistOfRecipes)

        {

           this.listOfRecipes=listOfRecipes;

        }

        

        static voidprintAllRecipeDetails(String selectedRecipe)

        {

           for (int i = 0; i

           { // traverse ArrayList

               // fetches the element at i position and compare its name with theaargument string

               if(listOfRecipes.get(i).getRecipeName().equals(selectedRecipe))

               {

                   listOfRecipes.get(i).printRecipe(); // if matches then printsRecipes detail

               }

           }  

        }     public void printAllRecipeNames()

        {

           System.out.println(“List of Recipes are : “);

           for (int i = 0; i

               System.out.println(listOfRecipes.get(i).getRecipeName()); // justprints Recipe names

           }

        }

        static voidaddRecipe()

        {

           Recipe r= new Recipe();

           Recipe tmpRecipe = r.createNewRecipe(); // creates new Recipe

           listOfRecipes.add(tmpRecipe); // adds it to the ArrayList

        }

     

    /**

     *If the user enters a 1 they will proceedto add a recipe, if they enter a 2 the list of recipes will beprinted, and if they enter a 3 they will be prompted to enter a newrecipe

     * @param args

     */

    public static void main(String[] args ){

       // Create a Recipe Box

           Scanner menuScnr = new Scanner(System.in);

           System.out.println(“Menun” + “1. Add Recipen” + “2. Print AllRecipe Detailsn” + “3. Print All Recipe Namesn” + “nPleaseselect a menu item:”);

           while (menuScnr.hasNextInt() || menuScnr.hasNextLine()){

               System.out.println(“Menun” + “1. Add Recipen” + “2. Print AllRecipe Detailsn” + “3. Print All Recipe Namesn” + “nPleaseselect a menu item:”);

               int input = menuScnr.nextInt();

               String myRecipeBox=””;

               if (input == 1) {

                   addRecipe();

               }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

                       System.out.println((j + 1) + “: ” +listOfRecipes.get(j).getRecipeName());

                   }

               }else {

                   System.out.println(“nMenun” + “1. Add Recipen” + “2. PrintRecipen” + “3. Adjust Recipe Servingsn” + “nPlease select a menuitem:”);

           }

        }

    }

} . . .

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now