The following steps describe how to derive the approximate area of x^2:
1. Determine how close the approximate area needs to be to the true area (tolerance):

User Specified Accuracy Difference is LESS THAN
accuracy = 1 0.5 X 10-1 = 0.05
accuracy = 2 0.5 X 10-2 = 0.005
accuracy = 3 0.5 X 10-3 = 0.0005
:
:
2. Start with 5 rectangles (each will have the same width, but the heights will vary).

3. Determine their width by subtracting x1 from x2 and dividing by the number of rectangles.

4. For each of the rectangles, determine its height by determining the value of x2 in the middle of the rectangle. For example, the first rectangle’s middle is x1 + half the width, the second rectangle’s middle is x1 + half the width + 1 width, the third rectangle’s middle is x1 + half the width + 2 widths, etc. The height of each rectangle is its middle value applied to x2 (middle2).
5. The approximate area is the sum of the areas of each rectangle (height times width).

6. If the absolute difference between the approximate area and the true area is NOT less than the derived tolerance, repeat this process starting at step 3 with 5 times the number of rectangles.

this is what i got so far. Any help would be greatly appreciated.

``````void printArea (int accuracy, double x1, double x2) {

double error;

error = fabs(approxArea - trueArea);

width = (x1-x2)/rectangles;

height = x1 + (width++)/2;

approxArea = height * width;``````

Have you drawn your rectangles on paper, and annotated the diagram with the values you know.

It will help you visualise what you need to do.

sorry here we go

So did it help you to understand the problem?

If you simply drew the diagrams and uploaded them, then I guess you missed the point of the exercise.