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
The field that uses technology to manipulate and use information to improve healthcare is known as:_______
Sergeu [11.5K]

Answer:

Health informatics

Explanation:

7 0
1 year ago
A smart refrigerator can use what to detect when you are running low on milk, and then send a reminder to you on a wireless.
Olegator [25]

Answer:

RFID scanning or Barcode reader

Explanation

Smart refrigerators have inbuilt RFID scanning technology that help monitor the stock that is inside your fridge. Once you pass your items through the inbuilt RFID scanner in the fridge, the barcode of your items is cross-referenced with a database and given a unique tag for identification. This technology helps detect and track the stock that is inside your fridge and when you start running low, the RFID can be triggered to send a reminder as a notification on your email or a text message.

3 0
3 years ago
mapa mental con la explicación de que medios de comunicación y redes sociales intervienen en la construcción de tu identidad​
lisov135 [29]

Answer:

este presente yo cuando me pidieron eso

5 0
2 years ago
On five lane roadways, the center lane is designated for __________ and is used by vehicles traveling in both directions.
Alla [95]
Answer : The center lane is designated for left turns

Explanation: 
This lane is used so that drivers would pull into in order to turn left when a clear merge is available. Its main purpose is not to cause traffic jam while waiting for the chance to turn left. It is illegal to use this lane for any other purposes
5 0
3 years ago
Design the program in the following way:
natali 33 [55]

Answer:

d = {}

while True:

   name = input("Enter the name of the boat (Press Enter or q to stop): ")

   if name == "" or name == "q":

       break

   time = int(input("Enter the time (in seconds): "))

   d[name] = time

winner_name = min(d, key=d.get)

winner_time = min(d.values())

average_time = sum(d.values()) / len(d.values())

slowest_boat = max(d, key=d.get)

slowest_time = max(d.values())

print(f"Winner name: {winner_name} and its time: {winner_time}")

print(f"Average time: {average_time}")

print(f"Slowest boat: {slowest_boat} and its time: {slowest_time}")

Explanation:

*The code is in Python.

Create an empty map(dictionary) to hold the values

Create a while loop. Inside the loop:

Ask the user to enter the name of the boat. Check if the user presses Enter or q, using if and break

Ask the user to enter the time

Insert these values as key-value pair to the map

When the loop is done:

Find the winner_name, the min() function finds the minimum value in a list. In this case, the key=d.get creates a list of the values in the map. The min(d, key=d.get) returns the key of the minimum value

Find the winner_time, min(d.values()) returns the minimum time in our map

Find the average time, the sum() function, returns the sum of the values in a list. In this case, sums all the values in the map. The len() function finds the count of the values. If we divide the sum of times entered by the count of the times entered, we get the average time

Find the slowest_time, the max() function returns the max of the value in a list. In this case, the maximum value is the slowest time

Print the results

5 0
2 years ago
Other questions:
  • We have to calculate the percentage of marks obtained in three subjects (each out of 100) by student A and in four subjects (eac
    11·1 answer
  • Disconnecting or making the equipment safe involves the removal of all energy sources and is known as _____________. A) Isolatio
    8·2 answers
  • Fill in the blank
    11·1 answer
  • What is the purpose of OPPA<br>​
    13·1 answer
  • WILL UPVOTE ALL
    10·1 answer
  • How can we style the images and layouts of our pages?
    8·1 answer
  • Write a java code to print Multiplication Table Till 20
    14·2 answers
  • Functions are used to _________
    10·1 answer
  • Spreadsheets are sometimes credited with legitimizing the personal computer as a business tool. Why do you think they had such a
    13·1 answer
  • Following Aristotle,man by nature is a political animal,justify the above claim in the light of the Russian invasion of Ukraine
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!