Input the variables with the appropriate data type

Assignment Help Basic Computer Science
Reference no: EM131994372

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

}

}

Reference no: EM131994372

Questions Cloud

Investing in machine that produces bowling balls : The Baldwin Company is considering investing in a machine that produces bowling balls.
Types of cyber hazards-state-sponsored threats and cyber : The types of cyber hazards we face from state-sponsored threats and cyber crime (social engineering as cybercrime, active persistent threats, malware
Eisc always needs conveyor belt system : If instead, assume that EISC always needs a conveyor belt system; when one wears out, it must be replaced. Which project should the firm choose now?
Examining the research in human development : Before completing this discussion, review Chapter 6 in your text. After examining the research in human development, please complete the following discussion.
Input the variables with the appropriate data type : Need to input the variables with the appropriate data type and value as shown in the table below:
What is the future value of an annuity : What is the Future Value of an annuity of $10,000, interest 10% for 12 years?
Why did you choose the leader : Why did you choose this leader? Discuss their leadership qualities/team collaboration and how those have influenced the organization's structure.
What are the risks and benefits of the outsourcing approach : What are the risks and benefits of the outsourcing approach? What are the strategic advantages of outsourcing to vertically integrated firms?
Explain how initial opinions changed : Explain how initial opinions changed, regarding ethical concerns, after the group discussion in Week Four. Describe any state laws that influenced a personal.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd