Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Need to input the variables with the appropriate data type and value as shown in the table below

Need help with completing the Java code mentioned below.

Need to input 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

Include an expression that multiplies the numberOfCups by the numberOfCalories per cup and assign this value to totalCalories.

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();

/**

* Include 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.”);

}

 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"