Question: Good Afternoon, My task is to create coding for a program desinged to managed recipes (Java). I am beginging by working with a recipe maanger

Good Afternoon,

My task is to create coding for a program desinged to managed recipes (Java). I am beginging by working with a recipe maanger program by focusing on a signle ingredient. I need to introduce Basic Data Types to store numeric values and string values.

I need to build this ingredient in code that reflects variables including; name, number of cups, and how many calories it has per cup. I will also need to write an expression to calculate the total number of calories this ingredient would contribue to a recipe.

I have a base code to work with and areas that require chages to base code and additonal 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 * */

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 number 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.");

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!