Question
Write a C++ program to evaluate the cumulative distribution function of the Poisson Distribution. For this program, you may assume the value of e is
Write a C++ program to evaluate the cumulative distribution function of the Poisson Distribution. For this program, you may assume the value of e is 2.71828. Make sure you conform to the following requirements.1. Call this programprobability.cpp2. Write a function called factorial that returns the factorial of a number. (10 points)3. Write a function called sum that takes x and as parameters and calculates F(x,) (25 points)4. Oversimplified definition: x can be considered to represent the number of customers in the restaurant at a time, and is analogous to the expected number of customers. The CDF then can represent the probability having less than the expected number of customers at a time.5. You may use the pow function to raise a number to a power.6. In the main function, accept various values of x and from the user and use the sumfunction to calculate the required CDF probability and print it. Stop if the user enters a negative value for x.(8 points)7. If the CDF for a set of inputs was less than 0.5, then the restaurant is not at optimum (either due to too few or too many customers). If is is so, print it. (2 points).8. You may assume that x will always be an integer.9. You may assume thatwill always be a positive number.10. You may use the iostream,iomanip and cmathlibraries.11. Make sure you add comments to explain your logic. (5 points)
F(x, 1) = 1! 1 12 2! I...! ) 0! 3! r! Write a CH program to evaluate the cumulative distribution function of the Poisson Distribution. For this program, you may assume the value ofe is 2.71828. Make sure you conform to the following requirements. 1. Call this program probability.cpp 2. Write a function called factorial that returns the factorial of a number. (10 points) 3. Write a function called sum that takes *x' and 'X'as parameters and calculates F(x,x) (25 points) 4. Oversimplified definition: *x' can be considered to represent the number of customers in the restaurant at a time, and is analogous to the expected number of customers. The CDF then can represent the probability having less than the expected number of customers at a time. 5. You may use the pow function to raise a number to a power. 6. In the main function, accept various values of 'x' and 'X' from the user and use the sum function to calculate the required CDF probability and print it. Stop if the user enters a negative value for x. (8 points) 7. If the CDF for a set of inputs was less than 0.5, then the restaurant is not at optimum (either due to too few or too many customers). If is is so, print it. (2 points). 8. You may assume that *x' will always be an integer. 9. You may assume that will always be a positive number. 10. You may use the iostream, iomanip and cmath libraries. 11. Make sure you add comments to explain your logic. (5 points) 3.1 Sample Run Enter the expected number of customers: 25 Enter the actual number of customers : 10 Probability of less than 10 customers was 0.0006 Under optimum performance Enter the actual number of customers : 35 Probability of less than 35 customers was 0.9776 Enter the actual number of customers : 19 Probability of less than 19 customers was 0.1336 Under optimum performance Enter the actual number of customers : 27 Probability of less than 27 customers was 0.7002 Enter the actual number of customers : -5Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started