The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Need help on the following c++ code, which approximates the integral of some pretty weird positive functions, and let the user input the range of
values.
PIC 10A HOMEWORK 5StorylineYour customers and staff are happy with the new system you just put in with the loops,and you can breathe a sigh of relief! Now, however, you have some leisure time and youdecided to have some fun with C++, especially since now you know how to generate randomnumbers! You decide that just for fun you are going to write a program that approximatesthe integral of some pretty weird positive functions, and let the user input the range ofvalues. The program will keep prompting the user to integrate until the user specifies thatthey are done.AssignmentThe assignment is to make a program that asks the user to numerically approximate theintegral of one of three functions, specify a range of integration, the number of iterations forthe approximation, and then approximate the integral using random numbers. The functionsare: 1.abs(sin(x2)), 2.e-x2, and 3.abs(arctan(x)). The program should keep promptingthe user to integrate one of the functions until requested to stop.Note: Do not change the default values of precision for this assignment. Simply outputvalues using cout and do NOT use fixed or cout.precision( ).AssumptionsYou may assume that will only input the numbers 1, 2, or 3 for the choice of function,that the lower and upper bounds will be numerical (not necessarily integer-valued!), andthat a 0 or 1 will be input to determine whether or not to prompt for another round ofapproximation.Also, Note thatabs(sin(x2)) ande-x2have a minimum value of 0 and a maximum valueof 1, and thatabs(arctan(x)) has a minimum value of 0 and a maximum value ofπ/2, whichyou may approximate using 1.571.An example of input/output is given below.1
Attachments:
-----------