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

Enter the length of a side of a square: 2 The perimeter of the square is: 8. The

ID: 3765171 • Letter: E

Question

Enter the length of a side of a square:
2
The perimeter of the square is: 8.
The area of the square is: 4.

Enter the length and width of a rectangle:
2
3
The perimeter of the rectangle is: 10.
The area of the rectangle is: 6.

Enter the radius of a circle:
4
The circumference of the circle is: 25.12.
The area of the circle is: 50.24.

Enter the lengths of the sides of a triangle:
5
3
2
Enter the base and height of the triangle:
3
4
The perimeter of the triangle is: 10.
The area of the triangle is: 6.

Enter the length and width of a parallelogram:
5
6
Enter the base and height of the parallelogram:
7

8
The perimeter of the parallelogram is: 22.
The area of the parallelogram is: 56.

Enter the radius of a sphere:
2.5
The surface area of the sphere is: 78.5.
The volume of the sphere is: 65.4167.

Enter the lengths of the sides of a trapezoid:
2
3
4
5
Enter the lengths of the parallel sides of the trapezoid:
1
2
Enter the height of the trapezoid:
3
The perimeter of the trapezoid is: 14.
The area of the trapezoid is: 4.5.

Enter the length, width, and height of a rectangular box:
4
5
6
The surface area of the box is: 148.
The volume of the box is: 120.

Enter the length of a side of a cube:
7
The surface area of the cube is: 294.
The volume of the cube is: 343.

Enter the radius of a cylinder:
2.6
Enter the height of a cylinder:
2
The surface area of the cylinder is: 75.1088.
The volume of the cylinder is: 42.4528.

Press any key to continue . . .

Explanation / Answer

#include <iostream>
using namespace std;

int main()
{
   float a,b,c,d,e,f,h,pi = 3.14;
   cout<<" Enter the length of a side of a square:";
   cin>>a;
   cout<<" The perimeter of the square is:"<<4*a;
   cout<<" The area of the square is:"<<a*a;

   cout<<" Enter the length and width of a rectangle:";
   cin>>a>>b;
   cout<<" The perimeter of the rectangle is:"<<2*(a+b);
   cout<<" The area of the rectangle is:"<<a*b;

   cout<<" Enter the radius of a circle:";
   cin>>a;
   cout<<" The circumference of the circle is:"<<2*pi*a;
   cout<<" The area of the circle is:"<<pi*a*a;

   cout<<" Enter the lengths of the sides of a triangle:";
   cin>>a>>b>>c;
   cout<<" Enter the base and height of the triangle:";
   cin>>d>>f;
   cout<<" The perimeter of the triangle is:"<<(a+b+c);
   cout<<" The area of the triangle is:"<<(0.5*d*f);

   cout<<" Enter the length and width of a parallelogram:";
   cin>>a>>b;
   cout<<" Enter the base and height of the parallelogram:";
   cin>>c>>d;
   cout<<" The perimeter of the parallelogram is:"<<2*a+2*b;
   cout<<" The area of the parallelogram is:"<<c*d;

   cout<<" Enter the radius of a sphere:";
   cin>>a;
   cout<<" The surface area of the sphere is:"<<4*pi*a*a;
   cout<<" The volume of the sphere is:"<<4*pi*a*a*a/3;

   cout<<" Enter the lengths of the sides of a trapezoid:";
   cin>>c>>d;
   cout<<" Enter the lengths of the parallel sides of the trapezoid:";
   cin>>a>>b;
   cout<<" Enter the height of the trapezoid:";
   cin>>h;
   cout<<" The perimeter of the trapezoid is:"<<(a+b+c+d);
   cout<<" The area of the trapezoid"<<h*(a+b)/2.0;

   cout<<" Enter the length, width, and height of a rectangular box:";
   cin>>a>>b>>c;
   cout<<" The surface area of the box is:"<<2*(a*b+a*c+b*c);
   cout<<" The volume of the box is:"<<a*b*c;

   cout<<" Enter the length of a side of a cube:";
   cin>>a;
   cout<<" The surface area of the cube is:"<<6*a*a;
   cout<<" The volume of the cube is:"<<a*a*a;

   cout<<" Enter the radius of a cylinder:";
   cin>>a;
   cout<<" Enter the height of a cylinder:";
   cin>>b;
   cout<<" The surface area of the cylinder is:"<<2*pi*a*b*(a+b);
   cout<<" The volume of the cylinder is:"<<pi*a*a*b;

   cout<<" Press any key to continue . . .";

   return 1;

}