QuestionQuestion

Milestone Two Guidelines: The Recipe Class

Overview: In your final project, you will create a program that will help you manage a collection of recipes.

The Recipe class you build for this milestone will hold all the details of the recipe, the methods to create a new recipe, and a method to print a recipe.

In your final project submission, this class will also contain a custom method to add a new feature.

In your submission for Milestone Two, you will include commented out pseudocode for this method.

Prompt: In this milestone, you submit the final project version of your Recipe class.

Your submission should include the Recipe.java file and a Recipe_Test.java file.

Your Recipe class should include the following items:

• Instance variables: recipeName, servings, recipeIngredients, and totalRecipeCalories

• Accessors and mutators for the instance variables

• Constructors

• A printRecipe() method

• A createNewRecipe() method to build a recipe from user input

• Pseudocode for the custom method selected from the list in Stepping Stone Lab Five

Your Recipe_Test.java file containing a main() method that:

• Uses a constructor to create a new recipe

• Accesses the printRecipe() method to print the formatted recipe

• Invokes the createNewRecipe() method to accept user input

Specifically, the following critical elements of the final project are addressed:

I. Data Types: Your Recipe class should properly employ each of the following data types that meet the scenario’s requirements where necessary:

A. Utilize appropriate numerical and string data types to represent values for variables and attributes in your program.

B. Populate a list or array that allows the management of a set of values as a single unit in your program.

II. Algorithms and Control Structure: Your Recipe class should properly employ each of the following control structures as required or defined by the scenario where necessary:

A. Utilize expressions or statements that carry out appropriate actions or that make appropriate changes to your program’s state as represented in your program’s variables.

B. Employ the appropriate conditional control structures that enable choosing between options in your program.

C. Utilize iterative control structures that repeat actions as needed to achieve the program’s goal.

III. Methods: Your Recipe class should properly employ each of the following aspects of method definition as determined by the scenario’s requirements where necessary:

A. Use formal parameters that provide local variables in a function’s definition.

B. Use actual parameters that send data as arguments in function calls.

C. Create both value-returning and void functions to be parts of expressions or stand-alone statements in your program.

D. Invoke methods that access the services provided by an object.

E. Describe a user-defined method that provides custom services for an object.

F. Create unit tests that ensure validity of the methods.

IV. Classes: Construct classes for your program that include the following as required by the scenario where necessary: A. Include attributes that allow for encapsulation and information hiding in your program.

B. Include appropriate methods that provide an object’s behaviors.

V. Documentation: Utilize inline comments directed toward software engineers for the ongoing maintenance of your program that explain the decisions you made in the construction of the classes in your program.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.util.ArrayList;
import java.util.Scanner;

/*
* Recipe class
*/
public class Recipe {

private String recipeName;
private int servings;
private ArrayList<Ingredient> recipeIngredients;
private int totalRecipeCalories;

// Constructor
public Recipe(String recipeName, int servings, ArrayList<Ingredient> recipeIngredients, int totalRecipeCalories) {
    this.recipeName = recipeName;
    this.servings = servings;
    this.recipeIngredients = recipeIngredients;
    this.totalRecipeCalories = totalRecipeCalories;
}

// Accessor method to get recipe name
public String getRecipeName() {
    return recipeName;
}

// Mutator method to set recipe name
public void setRecipeName(String recipeName) {
    this.recipeName = recipeName;
}

// Access method to get number of servings
public int getServings() {
    return servings;
}

// Mutator m...

By purchasing this solution you'll be able to access the following files:
Solution.docx and MilestoneTwo.zip.

$40.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats