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
Write a function that takes a string like 'one five two' and returns the corresponding integer (in this case, 152). A function j
Lelu [443]

Answer:

see explaination

Explanation:

def words2number(s):

words = s.split()

numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']

result = ""

for word in words:

if word in numbers:

result += str(numbers.index(word))

return result

4 0
3 years ago
Read 2 more answers
What command will unregister a component when run?
Advocard [28]
<span>Regsvr32.exe/u will unregister a component when run. Regsvr32.exe/u is a utility tool that is installed on Windows Xp or later versions of Windows. It has a 32-bit version and 64-bit version which can be found in the system root folder on a computer. It is capable of unregistering servers.</span>
7 0
3 years ago
Read 2 more answers
Write one line of code to print animals, an array of Animal objects.
oksian1 [2.3K]

Answer:

console.log(Animal);

Explanation:

The statement written above prints the array Animal which contains objects.There are two to three ways to print the array Animal in javascript. One of the method is written in the answer it prints the arrays in the console of the browser.

You can go to the console by pressing F12 and then clicking on the console.

Other methods to print are

  1. Simple write Animal after defining the array.
  2. Use alert.
  3. document.write()
7 0
2 years ago
3. How do robots help speed up the fulfillment of orders at some Amazon warehouses?
vagabundo [1.1K]

Answer:

B is the only answer that makes sence

6 0
3 years ago
Read 2 more answers
Mary has cleaned her data and is ready to determine the most efficient bus route. She starts by splitting the city into four reg
igomit [66]

ANSWER:

B.

Transforming the data might help Mary notice a different pattern that makes a bigger impact on bus routes than regions of the City.

EXPLANATION:

Mary can check if there are other things or factors that might influence where the bus routes need to be prioritized. For example if the students' age is considered for the bus routes instead of regions. She can achieve this by

By Re-sorting or Transforming the data.

That is to say she will be able to find out if it is only region or if there are different patterns that makes bigger impacts on bus routes, by transforming the data.

8 0
3 years ago
Other questions:
  • Which of the following parameters should match in order for a pair of routers to form an adjacency when running OSPFv2? (Points
    9·1 answer
  • for what reason do some security professionals consider insiders more dangerous than outside intruders?
    8·1 answer
  • The Knowledge Consistency Checker (KCC) ensures the maximum number of hops between any two domain controllers does not exceed wh
    12·1 answer
  • What is Brainly?<br><br> A.Yes<br> B.No
    12·2 answers
  • Can someone tell me what this means Higfaa
    6·1 answer
  • Ayuda pliz es para ya!!!!!<br> nesesito un codigo html que me muestre este texto
    8·1 answer
  • Why does Brainly keep on giving me ads. All I want to do is get answers not be smothered by a bunch of ads. And then when you go
    7·1 answer
  • Write. true or false​
    5·2 answers
  • What is meant by editing a document​
    5·2 answers
  • Which of the following calculations would evaluate to 12?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!