answer.
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
lilavasa
1 month ago
10

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. Do not type your input into the optional input box below, rather, input in response to the prompts in the output terminal window (prompts are given to you in the program template). 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 mg After 12 hours: 25.000000 mg After 18 hours: 12.500000 mg
Computers and Technology
1 answer:
8_murik_8 [948]1 month ago
5 0

Answer:

// C++ program.

#include <bits/stdc++.h>

using namespace std;

// main function

int main() {

  // variable

float n;  

cout<<"Enter the initial value:";

//User input

cin>>n;

//Variables for measurements at 6, 12, and 18 hours

float hours_6, hours_12, hours_18;  

//Set floating-point precision

cout << fixed;

    cout << setprecision(6);

 //Calculate caffeine amounts after 6, 12, 18 hours

hours_6 = n / 2.0;

hours_12 = hours_6 / 2.0;

hours_18 = hours_12 / 2.0;

//Display results

cout<<"After 6 hours: "<<hours_6<<"mg"<<endl;

cout<<"After 12 hours: "<<hours_12<<"mg"<<endl;

cout<<"After 18 hours: "<<hours_18<<" mg"<<endl;

return 0;

}

Explanation:

The program reads input from the user and sets the output precision to six decimal places. The caffeine amount after 6 hours is half the initial input. At 12 hours, it is half the 6-hour value, and after 18 hours, it is half the 12-hour value.

Output:

Enter the initial value:100

After 6 hours: 50.000000 mg

After 12 hours: 25.000000 mg

After 18 hours: 12.500000 mg

You might be interested in
Define a new object in variable sculptor that has properties "name" storing "Michelangelo"; "artworks" storing "David", "Moses"
zubka84 [1042]

Answer:

String [] artworks = {"David","Moses","Bacchus"};

Sculptor sculptor = new Sculptor("Michaelangelo",artworks,

"March 6, 1475","February 18, 1564");

Explanation:

  • In order to successfully tackle this task;
  • You should create a class (Java is the chosen language) featuring fields for the name, an array of artworks (strings), the date of birth and the date of death.
  • Utilize a constructor to initialize these fields
  • In a separate class SculptorTest, within the main method, generate a String array artworks assigned to {"David","Moses","Bacchus"};
  • Then create a new object of the class using the code provided in the answer section.
  • Refer to the provided code for the complete class definition below:

public class Sculptor {

private String name;

private String [] artworks;

private String bornDate;

private String diedDate;

public Sculptor(String name, String[] artworks, String bornDate, String diedDate) {

this.name = name;

this.artworks = artworks;

this.bornDate = bornDate;

this.diedDate = diedDate;

}

}

//Test Class with a main method

class SculptorTest{

public static void main(String[] args) {

String [] artworks = {"David","Moses","Bacchus"};

Sculptor sculptor = new Sculptor("Michaelangelo",artworks,

"March 6, 1475","February 18, 1564");

}

}

6 0
19 days ago
Widget Corp. wants to shift its list of inventory to a cloud so that its different branches can access it easily. The company ne
oksian1 [905]
The most suitable cloud option for Widget Corp, which requires a solution that is both cost-effective and does not risk exposing critical applications and data externally, is a hybrid cloud.
5 0
25 days ago
Write measurable performance objectives.Suppose that a trainer has identified as a generalgoal for a training module,"Able to fo
8_murik_8 [948]

Response:

Damon ComSci 037-0945 Activity 11-3 Formulate measurable performance objectives.... Imagine a trainer has set a broad aim for a training module, saying, “Able to format printed output in accordance with a specification sheet.” First, revise this goal statement to specify a quantifiable performance objective.

Explanation:

6 0
29 days ago
Tanya wants to include a video with all its controls on her web page. The dimensions of the video are as follows:
Natasha_Volkova [981]
I believe the correct answer is formats
4 0
17 days ago
Read 2 more answers
You are given a string of n characters s[1 : : : n], which you believe to be a corrupted text document in which all punctuation
ivann1987 [1023]

Response: explained in the explanation section

Explanation:

Given that:

Assume D(k) =║ true if [1::: k] is a valid sequence of words, or false otherwise

  • In determining D(n)

the sub problem s[1::: k] is a valid sequence of words IFF s[1::: 1] is valid and s[ 1 + 1::: k] is a valid word.

Thus, we derive that D(k) is defined by the following recurrence relation:

D(k) = ║ false max(d[l] ∧ DICT(s[1 + 1::: k]) otherwise

Algorithm:

Valid sentence (s,k)

D [1::: k]             ∦ array of boolean variables.

for a ← 1 to m

do;

d(0) ← false

for b ← 0 to a - j

for b ← 0 to a - j

do;

if D[b] ∧ DICT s([b + 1::: a])

d (a) ← True

(b). Algorithm Output

      if D[k] == True

stack = temp stack            ∦stack assists in displaying the strings in order

c = k

while C > 0

stack push (s [w(c)]::: C] // w(p) denotes the index in s[1::: k] of the valid word // at position c

P = W (p) - 1

output stack

= 0 =

cheers, I hope this aids you!!!

8 0
21 day ago
Other questions:
  • 6. Write pseudo code that will perform the following. a) Read in 5 separate numbers. b) Calculate the average of the five number
    6·1 answer
  • This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by
    15·1 answer
  • An author is preparing to send their book to a publisher as an email attachment. The file on their computer is 1000 bytes. When
    6·1 answer
  • Sarah works in a coffee house where she is responsible for keying in customer orders. A customer orders snacks and coffee, but l
    13·2 answers
  • When a CPU executes instructions as it converts input into output, it does so with
    12·1 answer
  • The table is an excerpt from an interviewer’s notes about three applicants applying to the IT department.                
    15·1 answer
  • 3. What is the error in the following pseudocode? // The searchName function accepts a string containing the name // to search f
    6·1 answer
  • A router has a valid operating system and a configuration file stored in nvram. the configuration file contains an enable secret
    10·1 answer
  • The ____________ protocol enables two users to establish a secret key using a public-key scheme based on discrete logarithms
    10·1 answer
  • The function below takes two numeric parameters. The first parameter specifies the number of hours a person worked and the secon
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!