C++ programming assignment
0 -1
0.5 -0.75
1 -0.5
1.5 -0.25
2 0
2.5 0.25
3 0.5
3.5 0.75
4 1
4.5 1.25
5 1.5
for the definite integral of Rxh This leads to the following ~ Area of a single trapezoid-Axtf(x.)+f(rent ax) Problem Statement measured in regular function from a user-specifled input text file (must have.txt file extension) and You are to write a program that takes paired data representing x and y fix) values the first calculates an approximation for the definite int summation ofto places. The text file with the data is formatted so it provides consecutive data point without units. The number of data points in the file is not known in advance so the program retrieves data points until the end of fileis reached. The program needs to also offer the user multiple runs using different files without needing to restart the program. outputting result using a user-specified number of decimal x and associated y value for each Specific program requirements are: Explain to the user what the program does making sure the user is told how to provide the data in text files and where to save the file 1. .Ask the user how many decimal places to show when data is provided on the console screen. 3. Set up an outer loop that allows the user to repeat the remaining part of the program multiple p b times using different data files. Ask user for name of text file (code for this provided in lecture notes & appendix). 4. Set up an organized table format (see sample output below) in preparation fot printing out the paired data from the file on the monitor for the user. 6. Set up a loop to execute the integration so that: a for leop Each (x, y) data pair is printed to the console screen for the user with the user-specified number of decimal places Calculate the area of each trapezoid using consecutive pairs of data. a. b. Add in the calculated area to a running total area. End loop when at the end of the data in the file. c. d. Report to the user on the console screen the approximation for the definite integral, again noting that units depend on the x and y axis units. Ask user if they want to perform calculation again with another data set. If no, end program. If yes, cycle back to 7. 8. The data provided is for a straight line connecting the points (0,-1) and (5, 1.5) so the final answer using simple geometry is 1.25 Sample Data File Contents: 0.5-0.75 2 -0.5 1.5 -0.25 2 0 2.5 0.25 3 0.5 3.5 0.75 4.5 1.25 5 1.5 Sample output to user if user indicated to show three decimal places