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
The primary function of a __________ is to translate the URL or web address a user enters in a web browser, into the correct cor
Mnenie [13.5K]
The primary function of a " Domain name server (DNS" is to translate the URL or web address a user enters in a web browser, into the correct corresponding IP address.
8 0
3 years ago
? An attempt to harm damage or cause threat to a system or network is broadly termed as
Radda [10]

Answer:

A cyber attack or hacking

Explanation:

6 0
2 years ago
Petra has an interview with an IT company. What technique can help prepare her?
SVEN [57.7K]
I would go C because that way it gets her prepared to answer any techie questions they would have for her and would make her a better option.
3 0
2 years ago
Read 2 more answers
Which of the given original work is protected by the copyright law?
Mila [183]

Answer:i would love to help but are there any answer choices?

Explanation: please provide answer choices for an accurate answer

6 0
3 years ago
This type of software can be described as end user software and is used to accomplish a variety of tasks. communications system
dezoksy [38]
This answer to this question is System
3 0
2 years ago
Other questions:
  • How to write "There are four parking spots on campus that may be used only by Nobel Prize winning faculty." this sentence correc
    12·1 answer
  • Systematically tackling the threats and vulnerabilities in the seven individual domains of a typical IT infrastructure helps you
    6·1 answer
  • WHAT 1 + 1 ???? ???????????????????
    15·2 answers
  • Which type of financial institution typically has membership requirements?
    11·1 answer
  • An email message containing a warning related to a non-existent computer security threat, asking a user to delete system files f
    6·1 answer
  • The fill command try’s to fill or generate content for cells based on a ________.
    15·1 answer
  • Java public class Odds { public static void main(String[] args) { printOdds(3); printOdds(17/2); int x = 25; printOdds(37 – x +1
    12·1 answer
  • The purpose of​ a/an _________ system is to capture best practice solutions and program them into a set of rules in a software p
    13·1 answer
  • Differences of a desktop computer and a laptop
    13·1 answer
  • Write a statement that calls the recursive method backwardsAlphabet() with parameter startingLetter.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!