Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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

}

}

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92832023
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Suppose there are three decks of cards on the table a

Suppose there are three decks of cards on the table, a number is written on each card. And each deck is sorted in decreasing order (The maximum value is on the deck in top). The goal is to find the minimum value between ...

Systems analysis project personal trainer inc owns and

Systems analysis project Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the company is planning an international expansion by opening a new "superce ...

According to a recent article the average number of babies

According to a recent article the average number of babies born with significant hearing loss (deafness) is approximately four per 1,000 babies in a healthy baby nursery. The number climbs to an average of 30 per 1,000 b ...

Question what is the relation between virtual memory a

Question : What is the relation between virtual memory, a memory map, physical memory and swapping to secondary memory? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow ...

Determine the number of moles of oleic acid in the

Determine the number of moles of oleic acid in the monolayer. Assume the nubmer of grams of oleic acid in the monolayer is  7.12×10 -6  g MW for oleic acid is 282 g/mol.

You isolate an acidic compound by suction filtration and

You isolate an acidic compound by suction filtration and think it is still wet. How do you remove the remaining water without the risk of decomposition (no extreme heating)

Suppose there are two links between a source and a

Suppose there are two links between a source and a destination. The first link has transmission rate 200 Mbps and the second link has transmission rate 15 Mbps. Assuming, that the only traffic in the network comes from t ...

A what is gdp deflator and how is it calculatedb if gdp

(a) What is GDP deflator and how is it calculated? (b) If GDP deflator for the year 2014 and 2015 are 105 and 108 respectively, then calculate the increase in price level between 2014 and 2015.

Question suppose an instruction can be carried out in 3

Question : Suppose an instruction can be carried out in 3 stages, the stages taking 3 ns, 7 ns, and 10 ns, respectively. (a) What is the maximum execution rate without pipelining? (b) What speedup is possible with pipeli ...

You are saving up to buy a toyota tundra which costs 35000

You are saving up to buy a Toyota Tundra, which costs $35000 now. You don't think the price of the Toyota will change over the next two years. You don't want to borrow to pay any of this cost. You now have $10000 toward ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As