Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that calculates the area under a curve. Here is the equation

ID: 3682844 • Letter: W

Question

Write a C++ program that calculates the area under a curve. Here is the equation: f(x) = x^2 + 1.5x + 4 You must prompt the user for the beginning and the ending x values. You are to assume, but not check, that the user will put in whole positive numbers. The units are inches. The program input/output should look something like this: This program calculates the area under a curve between two points on the x axis. The equation is: XXXXXXXX Please Enter the min x value: Please Enter in the max x value: The area under the curve between 'min x' and 'max x' is: 'total' square inches. You should calculate the area using the basic "rectangular slice" method. Set your x axis intervals at 1 inch. For example, if the user input the x range from 1 inch to 4 inches, you would have three x ranges: from 1 to 2, from 2 to 3 and 3 to 4 in which you calculate the area and make a sum of the total. Here is a second equation: f(x) = x^2 + 1.5x - 4 Program this equation in addition to the first. Prompt the user for how many segments the x axis should be divided into, Ie., if the user sets the x axis range from 3" to 8", part A and B would divide it into five segments. Now you prompt the user for how many segments should be used and do the proper calculations. Make all of the user inputs "idiot proof." Do a comparison study of the program. Meaning, the program will take more "time" when the number of x axis segments is larger. Also, the accuracy of the number should be greater, with more segments. In other words, you are trading off accuracy for run time. At what point does the number of segments provide improved accuracy vs. the "time" it take the program to execute? Have the user input a math equation and you do the calculations. Limit it to a fifth order polynomial equation.

Explanation / Answer

Calculates area under curve #include #include double f(float); int main(){ float xo,x; float a,b,h; double integral; int n; printf(" give left x value;:"); scanf("%f",&a); printf(" give right x value;:"); scanf("%f",&b); printf(" enter how many sections you want(bigger more accurate result):"); scanf("%d",&n); //calculations h=(b-a)/n; integral=(f(a)+f(b))/2; for (int i=1;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote