(Probability) The probability that a phone call will last less than t minutes can be pproximated by the exponential probability function:
Probability that a call lasts less than t
For example, assuming the average call length is 2 minutes, the probability that a call will last
less than 1 minute is calculated as
C++
Program plan:
- Include the header files and using the namespace for standard I/O.
- Define the main function.
- Declare the variables x and z of integer type and y of double data type.
- Declare the essential variables.
- Use the loop to iterate.
- Calculate the probability that the call last less than t minutes.
- Display the list of probabilities in tabular format
Program description:
The main purpose of the program is to calculate theprobability of that a call will last less than one minute. This is calculated by the below formula: -
Explanation of Solution
Program:
//Importing the essential headers #include <iostream> #include <iomanip> #include <math.h> //Using the namespace for standard I/O usingnamespacestd; //Defining the main function intmain() { //Declaring the essential variables double p;//to store the Probability double e =2.71828;//to store the Euler’s number int a=2;//to store the average call length cout<<"Call Time\tProbability\n"; //Using the loop to iterate for(int t =1; t <10; t++) { //Calculating the probability that the call last less than t minutes p =1-pow(e,(-1*t)/(a)); //Displaying the list of probabilities in tabular format cout<<setprecision(0)<< fixed << t <<"\t\t"<<setprecision(4)<< p <<endl; } }
Sample output:
Want to see more full solutions like this?
Chapter 5 Solutions
C++ for Engineers and Scientists
- 3. The velocity of a particle which starts from rest is given by the following table. t see) 0 2 8 10 12 14 16 v (fusee) o 12| 16 26 40| 44 25 12 18 Evaluate using trapezium rule, the total distance travelled in 18 seconds.arrow_forwardGot two wrong answer. I need right answer else downvotearrow_forward* When you throw a rock at some elevation part of its potential energy is converted to kinetic energy while another part is destroyed because of the hot surrounding False True * A pressure vessel can be treated as =thin-walled when the r/t 10 10 or greater 1 O is a point on stress-strain curve which indicates the limit of elastic behavior and the beginning of plastic behavior Yield point O Elastic point plastic pointarrow_forward
- 5. Let X be the random variable that represents the number of hearts in a 4 card hand drawn from a standard deck. (a) What is the probability distribution of X? (b) What is the expected value of X?arrow_forwardvatches? (2 pts.) 7. Find the probability that number 5 appears only once when a fair die is tossed 4 times.arrow_forwardcos h x thatarrow_forward
- 15-20 Solve the initial-value problem. 19. xy' = y + x² sin x, y(π) = 0arrow_forwardIncident Computation The sum of the years “at risk” of these 12 courses is 102 students-years, and there were 3 occurrence of disease. We can now compute the incident rate: (One decimal place only. No need to include “%” sign to your answer.)arrow_forwardThe fuel economy of a car is the distance which it can travel on one litre of fuel. The base fuel economy (i.e., its fuel economy when there is only one person - the driver - in the car) of a certain car is MM kilometres per litre. It was also observed that every extra passenger in the car decreases the fuel economy by 11 kilometre per litre. PP people want to take this car for a journey. They know that the car currently has VV litres of fuel in its tank. What is the maximum distance this car can travel under the given conditions, assuming that all PP people always stay in the car and no refuelling can be done? Note that among the PP people is also a driver, i.e., there are exactly PP people in the car. Solve in any programming languagearrow_forward
- The following equations estimate the calories burned when exercising (source): Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Men: Calories = ( (Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Write a program with inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men. Output each floating-point value with two digits after the decimal point, which can be achieved by executingcout << fixed << setprecision(2); once before all other cout statements. Ex: If the input is: 49 155 148 60 the output is: Women: 580.94 calories Men: 891.47 caloriesarrow_forwardInformation on morphine: Morphine can be administered via injection / IV. The quantity of morphine in a given dose may vary, but one guideline is to use 0.1 mg of morphine for each kg of the patient's body mass. The time taken for half the quantity of morphine to be removed from the body is 2 hours. An exponential function can be used to model the amount of morphine in the body over time: ?=?0???A=A0ekt (note that ?k will be negative). Calculate the value of ?k for morphine. Write a Python function called MorphineModel, which takes two arguments: dose amount ?0A0 and time since last dose ?t, and returns the amount of morphine in the body at this time ?t. Add to your computer code so that you have a program which is an implementation of the following flowchart. Ensure that your code is well-communicated to a user of the program (via the print statements) and well-communicated to someone reading the code (via comments).arrow_forwardProbability and Statistics I have in my pocket ten coins. Nine of them are ordinary coins with equal chances of coming up head and tail when tossed and the tenth has two heads. If I take one of the coins at random from my pocket, what is the probability that it is the coin with two heads ?arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr