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
stiv31 [10]
3 years ago
12

A half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-lif

e of about 6 hours in humans. Given caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 18 hours. Use a string formatting expression with conversion specifiers to output the caffeine amount as floating-point numbers.Ex: If the input is 100, the output is:After 6 hours: 50.000000 mgAfter 12 hours: 25.000000 mgAfter 18 hours: 12.500000 mgNote: A cup of coffee has about 100 mg. A soda has about 40 mg. An "energy" drink (a misnomer) has between 100 mg and 200 mg.
Computers and Technology
1 answer:
Elena L [17]3 years ago
8 0

Answer:

// here is code in java.

import java.util.*;

class Solution

{

// main method of class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // declare variable

         double caffeine;

    // scanner object to read input from user

       Scanner scr=new Scanner(System.in);

       System.out.print("Enter the initial amount of caffeine:");

        // read the initial amount of caffeine

           caffeine=scr.nextDouble();

          // calculate amount of caffeine after 6,12,18 hours

          for(int i=1;i<=3;i++)

          {

               System.out.println("After "+ i*6+" hours:"+(caffeine/2)+" mg");

               // update the caffeine after every 6 hours

               caffeine=caffeine/2;

          }

                 

   }catch(Exception ex){

       return;}

}

}

Explanation:

Create a variable "caffeine" to store the initial amount of caffeine given by user. Run a loop for three time, it will calculate the amount of caffeine left after every 6 hours.First it will give the amount of caffeine left after 6 hours, then caffeine left after 12 hours and in last caffeine after 18 hours.

Output:

Enter the initial amount of caffeine:100

After6 hours:50.0 mg

After12 hours:25.0 mg

After18 hours:12.5 mg

You might be interested in
HELPPPPPPP!!!!!!!!!
Andrei [34K]
The compression ratio is 20:1 please mark me brainliest
3 0
3 years ago
Integrated circuits are made up of _____ and carry an electrical current
Rasek [7]

Answer:

integrated circuits are made up of Transistor and carry an electrical current

4 0
4 years ago
How long is prison time for someone who commits copyright infringement for the first time ?
Murljashka [212]

Answer:

it is up to 5 years

Explanation:

7 0
3 years ago
Nancy needs to find the average of two numbers in the middle from an even count of numbers arranged in descending order. which s
Rus_ich [418]

i would say e. the median

7 0
3 years ago
Read 2 more answers
Please i need your help
motikmotik
Hello!

The answer would be:

C. non-linear navigation.

Explanation: Non-linear navigation lets a user navigate through material without them having to follow a strict order.

I hope that this helps you!
3 0
2 years ago
Other questions:
  • Need Help ASAP!
    14·2 answers
  • What would be the state of the following list after each of the first four passes in a Bubble sort, sorting into ascending seque
    15·2 answers
  • Access control lists (ACLs) are used to permit and deny traffic in an IP router.
    14·1 answer
  • _____ selectors are used to select elements based on elements that are adjacent to them in the document hierarchy.
    9·1 answer
  • Julio receives many emails from a healthcare site. He finds them useful, and he wants to save them all in a folder. How can he a
    12·1 answer
  • An algorithm whose worst-case time complexity is bounded above by a polynomial function of its size is called a(n)
    13·1 answer
  • How was kapilvastu named​
    11·1 answer
  • Ismael is examining a report in Access. He needs to access a view that will be used to examine and change the structure of the r
    9·2 answers
  • Ali has created a small program in Python, but he wants to store his data in a multi-dimensional array. He would like to use adv
    8·1 answer
  • Which of the following media forms is the Federal Communications Commission able to regulate content on?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!