1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
iren [92.7K]
3 years ago
10

A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 servings in the bag and that a se

rving equals 300 calories. Write a Java program that lets the user enter the number of cookies he or she actually ate and that then reports the number of total calories consumed.
Computers and Technology
1 answer:
laila [671]3 years ago
4 0

Answer:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

   Scanner in = new Scanner (System.in);

       System.out.println("How many cookies did you eat today");

       int numOfCookies = in.nextInt();

       double numCalories = (numOfCookies*300)/4;

       System.out.println("The total number of calories you consumed in "+numOfCookies+" cookies is " +

               " "+numCalories);

   }

}

Explanation:

This code is implemented in Java.

  1. We know from the question that 4 cookies contain 300 calories
  2. Therefore number of calories consumed = (number of cookies eaten*300)/4
  3. To implement this in java we used the scanner class to prompt user for the input
  4. save the input to a variable and write mathematical expression for the number of calories consumed
  5. Then output the result

You might be interested in
Copyright laws protect:This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this task a
agasfer [191]

B- Copyright laws protect original works both online and in print.

3 0
3 years ago
B. List any four major drawbacks of the first generation computer​
d1i1m1o1n [39]

Answer:

Terribly low storage space, limited to mathematics/computing, required entire rooms to use, and low information yield for hours of processing.

Explanation:

3 0
3 years ago
Is there such thing as free will
dybincka [34]

Answer:

Yes there is but it's rare cause everywhere we go we're tied down from some rules cause they help society function better

7 0
3 years ago
Read 2 more answers
How do I get rid of this?
kherson [118]

There Is an App that you downloaded that allows this. you have to find it and disable it

3 0
3 years ago
Read 2 more answers
Los elementos de la comunicación técnica son el medio, el código y el contenido, ¿Esta información es falsa o verdadera?
LenaWriter [7]

la respuesta es verdadera

Explanation:

V

7 0
3 years ago
Other questions:
  • Describe a time when you influenced someone else’s knowledge around technology, whether it be an app, a new gadget, etc. What di
    14·1 answer
  • You change a document that is saved on your computer by cutting text from the document what happens to the text when you preform
    5·1 answer
  • What is the best temperature to set your air conditioner on?
    12·1 answer
  • Hard light is usually not good for filming. True False
    11·2 answers
  • What is the FTC used car rule
    12·1 answer
  • How do you respond to an email?
    6·1 answer
  • A blue NFiPA label indicates: A) Health Hazard B) Special information C) Flammability D) Reactivity
    6·2 answers
  • Write a C++ program that computes an approximation of pi (the mathematical constant used in many trigonometric and calculus appl
    15·1 answer
  • A trust domain is defined as Select one: a. The agreed upon, trusted third party b. A scenario where one user needs to validate
    5·2 answers
  • A mesh network topology allows all computers to be directly connected. True or False
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!