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-life of about 6 hours in humans. Given caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 24 hours. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("After 6 hours: %.2f mg\n", yourValue); Ex: If the input is: 100 the output is: After 6 hours: 50.00 mg After 12 hours: 25.00 mg After 24 hours: 6.25 mg Note: 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. 1 import java.util.Scanner; 3 public class LabProgram { LN346 00 2 5 7 8 9 10 11} 12 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); double caffeineMg; // "double" supports floating-point Like 75.5, versus int for integers Like 75. } LabProgram.java caffeineMg = scnr.nextDouble(); /* Type your code here. */
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-life of about 6 hours in humans. Given caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 24 hours. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("After 6 hours: %.2f mg\n", yourValue); Ex: If the input is: 100 the output is: After 6 hours: 50.00 mg After 12 hours: 25.00 mg After 24 hours: 6.25 mg Note: 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. 1 import java.util.Scanner; 3 public class LabProgram { LN346 00 2 5 7 8 9 10 11} 12 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); double caffeineMg; // "double" supports floating-point Like 75.5, versus int for integers Like 75. } LabProgram.java caffeineMg = scnr.nextDouble(); /* Type your code here. */
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Concept explainers
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Question
![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-life of about
6 hours in humans. Given caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 24 hours.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("After 6 hours: %.2f mg\n", yourValue);
Ex: If the input is:
100
the output is:
After 6 hours: 50.00 mg
After 12 hours: 25.00 mg
After 24 hours: 6.25 mg
Note: 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.
1 import java.util.Scanner;
3 public class LabProgram {
06∞VOSAWNA
2
4
5
7
8
9
10 }
PER
11 }
12
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double caffeineMg; // "double" supports floating-point Like 75.5, versus int for integers Like 75.
LabProgram.java
caffeineMg = scnr.nextDouble();
/* Type your code here. */](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0cc153ae-b205-4fb2-9991-7cf6a21d5016%2Ff0b255d7-78e5-4622-a0fc-3f858d14d06d%2Fc8ae64_processed.png&w=3840&q=75)
Transcribed Image Text: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-life of about
6 hours in humans. Given caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 24 hours.
Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("After 6 hours: %.2f mg\n", yourValue);
Ex: If the input is:
100
the output is:
After 6 hours: 50.00 mg
After 12 hours: 25.00 mg
After 24 hours: 6.25 mg
Note: 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.
1 import java.util.Scanner;
3 public class LabProgram {
06∞VOSAWNA
2
4
5
7
8
9
10 }
PER
11 }
12
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double caffeineMg; // "double" supports floating-point Like 75.5, versus int for integers Like 75.
LabProgram.java
caffeineMg = scnr.nextDouble();
/* Type your code here. */
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education