Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Required Skills Inventory - Use variables to name, store, and retrieve values. - Use System, out. print to prompt the user for input - Use

image text in transcribed
image text in transcribed
Required Skills Inventory - Use variables to name, store, and retrieve values. - Use System, out. print to prompt the user for input - Use a Scanner to collect user input - Use math operators to construct an expression - Use String literals to define a String value - Output to console with System. out. printf - Use format specifiers to format floating point values in strings - Use escape sequences to construct a String expression Problem Description and Given Info A half life is the amount of time it takes for a substance or entity to fall to haif its original value Caffeine has a haif-life of about 6 hours in humans This means that if a human ingests 100mg of caffeine, then after 6 hours there will only be 50mg of caffeine left in their system. and after 12 hours there will only be 25mg left in their system. As the term 'halffife' implies, the amount decreases by haif each time interval. You write a Java program that will take, as input, an amount of caffeine ingested, and then compute and display the arnount of caffeine that will still be in the persoris system after 6,12 , and 18 hours 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. Note that the initial amount of caffeine will be entered as a double value, and the output values will also be double floating point values: Here are some examples of what the user should see when the program runs. Example 1 Enter caffeine amount (in mg) : 100 After 6 hours :50.00ng Enter caffeine amount (in mg):40 After 6 hours :20.00mg After 12 houra : 10+00mg After 18 hours : 5.00mg For the given inputs, make sure that your program output looks exaotly like the examples above (including spelling, capitalization, punctuation, spaces, and decimal points) Hints and Helpful Info: - Remember that you can use System. out. printf to format your outputs so that they have the required number of decimal places Need Help? Additional help resources are available by clicking on the words "Need Help?" at the bottom of this page, and search for help or ask a questionl

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+1. Describe the value chain of the media industry!

Answered: 1 week ago

Question

=+3. Draw the submodels of an integrated business model!

Answered: 1 week ago