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
Select the correct answer. Larry finds it easy to run legacy programs and applications in a virtualized environment. How does th
muminat

The answer is B: installs and runs different versions of an operating system on the same computing device

Virtual machines are like guest operating systems or application environments that give you the perception that you are physically connected to a different box. A system virtual machine, for instance, copies all the components and processes of a real computer. It helps the user experiment with different operating systems and applications without the need to install them on your physical hardware.


8 0
2 years ago
When you open as many links as you want, and still stay in the same browser window instead of cluttering your screen with multip
emmainna [20.7K]

Answer:

a. Tabbed browsing

Explanation:

Tabbed browsing is a feature in the browser that helps in operating several tabs at the same time. It helps in browsing different links without opening different browsers. Multiple pages can be opened and surfed at the same time in one window. Any link can be opened in a different or new tab by clicking right on the link. After this, 'open link in new tab' is to be selected and the link gets opened respectively.

3 0
2 years ago
toThePowerOf is a method that accepts two int arguments and returns the value of the first parameter raised to the power of the
inessss [21]

Answer:

cubeVolume = toThePowerOf(cubeSide, 3)

Explanation:

The function toThePowerOf, receives two int arguments say, a and b, where a is the first argument and b is the second argument as follows:

toThePowerOf(a,b)

The function returns the first argument(a) raised to the power of the second argument (b) i.e a ^ b as follows:

toThePowerOf(a, b){

return a^b

}

In the call to the function, the first argument a, is replaced with the variable cubeSide and the second argument b is replaced with the value 3.

Hence, the returned result becomes cubeSide ^ 3 which is then stored in a variable cubeVolume as follows:

cubeVolume = toThePowerOf(cubeSide, 3)

6 0
2 years ago
Why people shouldnt get married​
inn [45]
Well it depends if your thinking! I know many reasons why people should get married but I also know many reasons why people shouldn’t get married!

For an example if you are a man and you don’t want to get married, well I think it’s 50% wrong and another 50% right cause if you want to enjoy life and not be stuck with the same wife you wouldn’t get married, but now think of having a family when you get married you receive a blessing, cause you will have son , daughters and a wife who will support you all the time!
3 0
2 years ago
Find the area of square whose perimeter is 260.8m​
inessss [21]
4251.04

The perimeter (260.8) over 4 is equal to each side length (65.2)

65.2^2 = 4251.04
5 0
2 years ago
Other questions:
  • Which of the following is an example of a logic bug?
    8·1 answer
  • Please helpp!! I need it quickly!
    6·1 answer
  • Name the function in Python that prompts user to enter values as per the data type specified.
    5·1 answer
  • William found out that someone used his report on American culture without his permission. What is William a victim of? A. plagi
    7·2 answers
  • You are tasked with accumulating survey data on a web page and are responsible for it being free from dirty data once you close
    11·1 answer
  • What is an Apple Pen?
    5·2 answers
  • Describe an energy problem a city in 2050 will face
    6·1 answer
  • Which of the following statement is correct? Select one: a. Base register holds the size of a process. b. Limit register holds t
    10·1 answer
  • Select the correct answer from the drop-down menu.
    15·2 answers
  • Which type of GUI control would be best to use if you wanted the user to select one date from a list of three possible dates to
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!