InstructionsNow 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:Stepping Stone Lab Five GuidelinesStepping Stone Labs Two Through Six Rubric
stepping_stone_5.docx
stepping_stone_recipe_test.docx
Unformatted Attachment Preview
package SteppingStones;
import java.util.Scanner;
import java.util.ArrayList;
public class SteppingStone5_Recipe {
private String recipeName;
/**
* Add three variables:
*
* 1. a variable ‘servings’ to store how many people the recipe will feed;
*
* 2. an ArrayList variable ‘recipeIngredients’ to store the text for the
* names (recipeName) each recipe ingredient added
*
* 3. a variable totalRecipeCalories
*
*/
/**
* Add mutators and accessors for the class variable.
*
*/
public SteppingStone5_Recipe() {
this.recipeName = “”;
this.servings = ??? //<--- assignment value with appropriate data type this.recipeIngredients = ???; //<-- assignment value for empty ArrayList this.totalRecipeCalories = 0; } public SteppingStone5_Recipe(String recipeName, ??? 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; } public void printRecipe() { /** * Declare an int variable singleServingCalories. * Assign singleServingCalories to * the totalRecipeCalories divided by the servings * */ } /** * Print the following recipe information: * Recipe: <>
* Serves: <>
* Ingredients:
* <>
* <>
* …
* <>
*
* Each serving has <> Calories.
*
* HINT –> Use a for loop to iterate through the ingredients
*/
public static void main(String[] args) {
??? totalRecipeCalories = ???;
ArrayList recipeIngredients = new ArrayList();
boolean addMoreIngredients = true;
Scanner scnr = new Scanner(System.in);
System.out.println(“Please enter the recipe name: “);
String recipeName = scnr.nextLine();
System.out.println(“Please enter the number of servings: “);
//correct data type & Scanner assignment method for servings variable
???? servings = ????
do {
System.out.println(“Please enter the ingredient name
or type end if you are finished entering ingredients: “);
String ingredientName = scnr.next();
if (ingredientName.toLowerCase().equals(“end”)) {
addMoreIngredients = false;
} else {
/**
* Add the ingredient name to recipeIngredients
*
*/
System.out.println(“Please enter the ingredient amount: “);
float ingredientAmount = scnr.nextFloat();
System.out.println(“Please enter the ingredient Calories: “);
int ingredientCalories = scnr.nextInt();
/**
* Add the total Calories from this ingredient
* (ingredientCalories * ingredientAmount)
* to the totalRecipeCalories
*
*/
}
} while (!reply.equals(“n”) ;
}
SteppingStone5_Recipe recipe1 = new SteppingStone5_Recipe(recipeName,
servings, recipeIngredients, totalRecipeCalories);
recipe1.printRecipe();
}
/**
* 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 be adding the
*
actual ingredient including name, amount, measurement type,
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 allow users to
*
insert step-by-step recipe instructions
*
*
c. conversion of 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
*
*/
package SteppingStones;
import java.util.ArrayList;
/*
* 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.
*/
public class SteppingStone5_RecipeTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Create two recipe objects first
SteppingStone5_Recipe myFirstRecipe = new
SteppingStone5_Recipe();
ArrayList recipeIngredients = new ArrayList();
ArrayList recipeIngredientsTwo = new ArrayList();
String ingredientName = “Anchovies”;
Ingredient tempIngredient = new
Ingredient().addNewIngredient(ingredientName);
recipeIngredients.add(tempIngredient);
SteppingStone5_Recipe mySecondRecipe = new
SteppingStone5_Recipe(“Pizza”, 2, recipeIngredients, 300);
// Initialize first recipe
String ingredientNameTwo = “Noodles”;
Ingredient tempIngredientTwo = new
Ingredient().addNewIngredient(ingredientNameTwo);
recipeIngredientsTwo.add(tempIngredientTwo);
myFirstRecipe.setRecipeName(“Ramen”);
myFirstRecipe.setServings(2);
myFirstRecipe.setRecipeIngredients(recipeIngredientsTwo);
myFirstRecipe.setTotalRecipeCalories(150);
// Print details of both recipes
myFirstRecipe.printRecipe();
mySecondRecipe.printRecipe();
}
}

Purchase answer to see full
attachment

Are you having trouble with the above assignment or one similar?

To date, 239 students have ordered this same assignment from us and received 100% original work. We can do the same for you!

We offers 100% original papers that are written from scratch.We also have a team of editors who check each paper for plagiarism before it is sent to you.

Click this “order now” button to see free Cost Breakdown!