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

  What is the probability that she really is

If a woman is chosen at random from those living in this neighborhood, and if the test indicates she is pregnant, what is the probability that she really is?

  Implementing security for organization

As the lead IT person tasked with implementing security for their organization, a dot com startup. The company you work for has 30 employees

  Same for all three buttons

A vending machine has three buttons, labeled A, B, and C. The cost is the same for all three buttons. If you press A, you get a pound of fertilizer. If you press B, you get a pet rat. If you press C, you randomly get either fertilizer or a pet rat..

  Classification of data and variables

Classification of data and variables

  What is the maximum entropy distribution for random variable

What is the maximum entropy distribution for this random variable? Justify your answer.

  Strategically to enhance motivation levels

What is job design and how can it be used strategically to enhance motivation levels? Please reference and cite scholarly sources in your comments.

  Data gathering and mockup

Add a data gathering component for the users. This is similar to gathering your own analytics in one way for the users. How will you analyze the data and then what way will you summarize the findings to stakeholders of your site that are funding t..

  Briefly describe how you could achieve this

Suppose you would like to have most of your program variables residing in external RAM while a few time-critical variables should reside in the first 128 bytes of internal RAM. Briefly describe how you could achieve this.

  Pros and cons of object oriented programming and design

What is the pros and cons of Object Oriented Programming and Design? Please with details and references.

  How do you determine the type of malware

How do you determine the type of malware that is present on the computer or device and provide a rationale for doing so? In your opinion, do you think that the vulnerabilities can be minimized in the future

  Prove that a is worth at least as much as b

Suppose two options, A and B, have the same pay-offs but A is exercisable on all the dates B is and more. Prove that A is worth at least as much as B. Give an example where they have the same value.

  Planning process for networks and network security

Many times in the IT world redundancy is avoided. However, some state that redundancy is part of the recommended planning process for networks and network security.

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