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
what is the largest possible number of internal nodes in a redblack tree with black height k? what is the smallest possiblenumbe
Elina [12.6K]

Answer:

A Red Black Tree is a type of self-balancing(BST) in this tree ,each node is red or black colored. The red black tree meets all the properties of the binary search tree, but some additional properties have been added to a Red Black Tree.

A Red-Black tree's height is O(Logn) where (n is the tree's amount of nodes).

In a red-black tree with black height k

The maximum number of internal nodes is 2^{2k} -1.

The smallest possible number is 2^{k} -1.

7 0
3 years ago
What is a different paragph formatting tools
soldi70 [24.7K]
You can have paragraph alignment which is left, right, and center
5 0
3 years ago
Which of the following is NOT a rule you should follow when creating a presentation?
Nataly_w [17]
False, Write in full sentences and paragraphs on your slides - It is your presentation! Make it how you want to 
8 0
3 years ago
A new laptop was delivered to your home and left on the porch while you were at work. It is very cold outside, and you don't kno
kifflom [539]

Answer:

Let the computer warm up to room temperature before turning it on.

Explanation:

The laptop has been shipped to the user's home when he were at work and found on the deck. Outside it is really cool and he don't remember how long it has been there. Then, the user open his laptop and want to know whether it is functioning properly. Instead, let the machine warm up while switching it on to room temperature.

When a computer is still in a cold climate, they have to let it heat up to room temperature apx. 6-24 hours before switching it on. Otherwise, its heat the elements generate could cause water moisture within the laptop. That water could then harm elements of the system.

7 0
3 years ago
Protocol 2 - Check for Errors
Lapatulllka [165]

Please note that the Problem to be solved from Protocol 1 is not provided hence the general answers. To construct and send, open a network environment a single multi-packet message, simply click "Add Packet" and then click "Send at Once".

<h3>How will the receiver know the order of the packets or if any are missing?</h3>

If the text or message sent does not make any reading sense, or if certain words are jumbled and out of place, then it is clear that something is wrong.

If the messages arrive in a coherent fashion, then the packet was fully received.

<h3>How will the receiver request missed packets and what will the sender do in response?</h3>

Where the users are familiar with the Transmission Control Protocol, lost packets can be detected when there is a timeout. Lost packets are referred to as Dropped packets.

Learn more about Packets at:
brainly.com/question/17777733

7 0
1 year ago
Other questions:
  • You just read an msds for acetic acid. based on what you read, what type of information is included in an msds sheet? record you
    7·1 answer
  • What makes for a good algorithm compatibility complexity humor correctness efficiency?
    11·1 answer
  • What port in your computer will you use to plug in your camera?
    14·2 answers
  • A formal log-on procedure is the operating system’s last line of defense against unauthorized access.
    10·1 answer
  • Choose all items that represent characteristics of an HTML element. used to include additional information in an attribute consi
    15·1 answer
  • If a piece of software designed to run on Windows XP can run on the latest version of Windows, we say the latest version of Wind
    14·1 answer
  • man who is colorblind marries a woman who has normal color vision and is not a carrier of color blindness. If this couple has a
    15·1 answer
  • What was the first 1.0.1 version of openssl that was not vulnerable to heartbleed?
    5·2 answers
  • Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by ea
    12·1 answer
  • 2. Who created the first photograph? How was this done?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!