Question: Write a program that will approximate the area under the function f(ac) = a2 - 2ac + 3 by using both a single rectangle and

Write a program that will approximate the area under the function f(ac) = a2 - 2ac + 3 by using both a single rectangle and a single trapezoid, see the figure. The rectangle should use the left bound as the height. The program, when run, prompts the user for the left bound and then the right bound, printing the areas before terminating. Here is an example run: This program approximates the area under f (x) = x* *2 - 2x + 3 given two bounds Input the left bound: -1 Input the right bound: 2 The approximate area under f (x) from -1.0 to 2.0 is: Rectangle: 18.0 Trapezoid: 13.5 Given both bounds and the corresponding heights, the area of a trapezoid is Areatrap = (boundR - boundL) X (h1 + h2) 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
