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
Which scenario is most likely due to an everyday problem rather than a
tester [92]

The scenario is most likely due to an everyday problem rather than cultural difference among people collaborating online is option D. A team member's bandwidth is limited, and the video feed keeps freezing.

<h3>What is collaborating online?</h3>

Online collaboration is known to be a term that connote the use the internet as well as other forms of online tools to be able to work together on some work or project.

Note that it is one that is done Instead of a person sitting in a physical office space, the online collaboration gives room for employees to be able to work together from different locations and tech by accessing the virtual work environments as well as other shared online workspaces.

Therefore, The scenario is most likely due to an everyday problem rather than cultural difference among people collaborating online is option D. A team member's bandwidth is limited, and the video feed keeps freezing.

Learn more about collaborating online from

brainly.com/question/514815

#SPJ1

6 0
1 year ago
Create an interactive program to use class a LightsOut class to allow a user to play a game. Each step in the game will require
expeople1 [14]

Answer:

9+10=21

Explanation:

wyd boy

8 0
3 years ago
Topic: Video Games.
Butoxors [25]

Answer:

Fire Emblem

Explanation:

4 0
3 years ago
What is the memory of a computer called
Nataliya [291]
It is called Ram in another term for memory :)
6 0
3 years ago
Read 2 more answers
The _________ in an internet are responsible for receiving and forwarding packets through the interconnected set of networks and
raketka [301]

Answer:

routers

Explanation:

<h2><em><u>Fill in the blanks</u></em></h2>

The<u> routers </u> in an internet are responsible for receiving and forwarding packets through the interconnected set of networks and making routing decisions based on knowledge of the topology and traffic/delay conditions of the internet.

3 0
3 years ago
Other questions:
  • The number of operations executed by algorithms A and B is 40n2 and 2n3, respectively. Determine n0 such that A is better than B
    12·1 answer
  • Does time complexity depend on, which base arithmetic you use? like base 10, 2 or whatever else? Does time coplexity depned on t
    13·1 answer
  • The Status bar is used to control the majority of the drafting settings in AutoCAD
    13·1 answer
  • What is the maximum number of VLANs that can be configured on a switch supporting the 802.1Q protocol? Why?
    11·2 answers
  • How to code on python
    8·2 answers
  • Write a method called removeHighPrice that will go through a provided ArrayList called prices and removes the first price that i
    6·1 answer
  • What is computer code?<br> A. Java Script<br> B. XML<br> C. HTML<br> D. Any programming language
    6·1 answer
  • Is this statement true or false? Title text boxes on every slide must be the same format. True false.
    8·2 answers
  • What is are the most efficient ways to make a slide presentation?
    12·2 answers
  • Flash drive / USB is ___________ device. A)Input B)Output C)Internal D)None of these
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!