[Recommended]Recipe Manager Data Types

Recipe Manager Data Types IT 511 Stepping Stone Lab Two Guidelines Recipe Manager Data Types Overview: For this stepping stone lab and others to come,…

Recipe Manager Data Types
IT 511 Stepping Stone Lab Two Guidelines
Recipe Manager Data Types
Overview: For this stepping stone lab and others to come, you will create coding for a program designed to manage recipes. In Stepping Stone Lab Two, you will begin working with a recipe manager program by focusing on a single ingredient. You will be introduced to basic data types to store numeric values and string values.
You will build this ingredient in code that reflects variables such as its name, the number of cups of that ingredient needed in the recipe, and how many calories
it has per cup. You will also write an expression to calculate the total number of calories this ingredient would contribute to a recipe.
To keep track of this information, you need to store it in a program. You will need to utilize variables of various data types to store the information and prompt
the user for the various values. Once you get that information from the user, you can calculate the total number of calories per serving in your recipe.
Prompt: Use SteppingStone2_IngredientCalculator.java as your base code. Areas that require changes to the base code and/or additional code to be written are found in the commented areas that look like this: /** * This is a commented area that describes the task to be completed in this stepping stone * */ Specifically, you will complete the following:
A. Assign the variables with the appropriate data type and value as shown in the table below:
Variable Name Type of Value Stored
nameOfIngredient Text
numberOfCups Decimal numbers (e.g., ½ a cup)
numberOfCaloriesPerCup Whole numbers
totalCalories Decimal numbers
B. Write an expression that multiplies the numberOfCups by the numberOfCalories per cup and assign this value to totalCalories. Guidelines for Submission: This assignment should be submitted as a Java file.
Extending This Lab for Your Final Project For your final project, do the following:
1. Create a new java class named Ingredient.
2. Adapt the code from this stepping stone to include the following changes: A. Rename the variable numberCups to represent the more general ingredientAmount. B. Add a new text variable, unitMeasurement, to store unit of measurement for the ingredient amount (cups, ounces, etc.). C. Prompt the user to input the measurement unit.
SteppingStone2_IngredientCalculator.java
package SteppingStones;
import java.util.Scanner;
/**
*
* @author j.leone1
*/
public class SteppingStone2_IngredientCalculator {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
/**
*Assign the following variables with the appropriate data type and value:
*VARIABLE NAME VALUE
*nameOfIngredient “”
*numberCups 0
*numberCaloriesPerCup 0
*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 number of cups of ”
+ nameOfIngredient + ” we’ll need: “);
numberCups = scnr.nextFloat();
System.out.println(“Please enter the name of calories per cup: “);
numberCaloriesPerCup = scnr.nextInt();
/**
* Write an expression that multiplies the number of cups
* by the Calories per cup.
* Assign this value to totalCalories
*/
System.out.println(nameOfIngredient + ” uses ” + numberCups
+ ” cups and has ” + totalCalories + ” calories.”);
}
}

The post Recipe Manager Data Types appeared first on ExpertCustomWritings.
Assignment status: Solved by our experts

>>>Click here to get this paper written at the best price. 100% Custom, 0% plagiarism.<<<

Leave a Reply

Your email address will not be published. Required fields are marked *