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

I NEED HELP WITH MY PYTHON PROGRAM!!!! NOT C++ I need help getting the height of

ID: 3930924 • Letter: I

Question

I NEED HELP WITH MY PYTHON PROGRAM!!!! NOT C++
I need help getting the height of the trapezoid and rectangle for this python program!!!!!

n number of rectangles and/or trapezoids a- beginning x value b - ending x value bending x value wwidth of each rectangle/trapezoid, (b-a)/n f(x) - height of rectangle (f (x1)+f(x2))/2 - height of trapezoid Area - width*height Integration Program Definition Your program should determine the area under these different functions, f1 (x) - 5x4 + 3x3 - 10x + 2 f2(x) - x2-10 f (x) = 40x + 5 f5(x)- 20x2 + 10x - 2

Explanation / Answer

include <iostream>

#include <iomanip>

using namespace std;

int main()

{

    const double PI = 3.14159;

    double radius=0.0;

    double area=0.0;

    double length=0.0;

    double width=0.0;

    double base=0.0;

    double base1=0.0;

    double base2=0.0;

    double height=0.0;

    int choice=0;

    cout << "Geometry Calculator ";

    cout << " ";

    cout << "1. Calculate the area of a Circle ";

    cout << "2. Calculate the area of a Rectangle ";

    cout << "3. Calculate the area of a Triangle ";

    cout << "4. Calculate the area of a Trapezoid ";

    cout << "5. Calculate the area of a Sphere ";

    cout << "6. Exit ";

    cout << "Enter your choice (1-6): ";

    cin >> choice;

   

    if (choice>=1 && choice<=6)

    {   

        switch (choice)

        {

            case 1: //Area of Circle

                cout << " ";

                cout << "Enter the circle's radius: ";

                cin >> radius;

               

                if (radius>0)

                {   

                    area = (PI * radius * radius);

                    //cout << fixed << setprecision(4);

                    cout << "The area is " << area;

                break;

            case 2: //Area of Rectangle

                cout << " ";

                cout << "Enter the rectangle's length: ";

                cin >> length;

                cout << "Enter the rectangle's width: ";

                cin >> width;

               

               if (length>0 && width>0)

                {   

                    area = length * width;

                    cout << "The area is " << area;

                break;

            case 3: //Area of Triangle

                cout << "Enter the length of the base: ";

                cin >> base;

                cout << "Enter the triangle's height: ";

                cin >> height;

               

                if (base>0 && height>0)

                {   

                    area = (base * height)/2;

                    cout << "The area is " << area;

                    break;

            case 4: //Area of a Trapezoid

                cout << "Enter the Trapezoid's height";

                cin >> height;

                cout << "Enter the Trapezoid's base 1";

                cin >> base1;

                cout << "Enter the Trapezoid'd base 2";

                cin >> base2;

               

                if (base1>0 && base2>0 && height>0)

                {

                    area = (height * (base1 + base2))/2;

                    cout << "The area is " << area;

                    break;

            case 5: //Area of a Sphere

                cout << "Enter the Sphere's radius";

                cin >> radius;

                   

                if (radius>0);

                {

                    area = (4)*(PI * radius * radius)

                    cout << "The area is " << area;

                    break;

            case 6: //Exit

                cout << "Program Ending.";

                break;

               

                   

        }

    }

    else

    {

        cout << "The valid choices are 1 through 6. Run the program again and select one of those.";

    }

    return 0;

}