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
_____ is an example of a locally installed email client.
levacccp [35]
Gmail is an example of a locally installed email client
6 0
3 years ago
Read 2 more answers
The domain in an email message tells you the
bezimeni [28]
The question is asking to choose among the following choices that state what would the domain in an email represents, base on my research, I would say that the answer would be letter B. location of the destination. I hope you are satisfied with my answer and feel free to ask for more 
8 0
3 years ago
(EASY)
AnnyKZ [126]
If you go to a college website you will see the it has .edu in the URL extensions.
3 0
3 years ago
Read 2 more answers
What is percent encoding and why is it used?
ehidna [41]

Answer:

 Percent encoding is the mechanism for encoding the information in the URI  (Uniform resource identifier) that basically transmitted the special variable or characters in the URI to the cloud platform.

It is also used in various application for transferring the data by using the HTTP requests.

Percent encoding is also known as uniform resource locator (URL) encoding. The percent encoding basically used to convert the non ASCII characters into URL format which is basically understandable to the all the web server and browsers. In percent encoding the percent sign is known as escape character.

7 0
2 years ago
Is the core of an operating system that controls its basic functions.
WINSTONCH [101]

Answer:

Explanation:

Tweaker

5 0
3 years ago
Other questions:
  • While investigating the settings on your SOHO router, you find two IP addresses reported on the device’s routing table, which is
    15·1 answer
  • To insert a new slide in an existing presentation, what menu should you select?
    5·2 answers
  • Advantages of a personal area network
    5·1 answer
  • Can a computer will work more efficiently if you perform disk optimization
    9·1 answer
  • A(n) ____ path is a path used for external links that includes the complete address for the destination page, including the prot
    12·1 answer
  • Bulleted and Numbered List button appear in the ………….. Toolbar.​
    6·1 answer
  • Convert 578.2 into hexadecimal​
    9·1 answer
  • Is it possible for the front and rear references in a circular array implementation to be equal?
    8·1 answer
  • If your database is in archivelog mode, how can you force an archive?
    7·1 answer
  • Ryan is working on a document with many secotions. For each section,he wantes to have the title bolded,underlined,an blue. Which
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!