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

The area of a pentagon can be computed using the following formula: area = 5 * s

ID: 3631028 • Letter: T

Question


The area of a pentagon can be computed using the following formula:

area = 5 * s2
4 * tan(pie/5)

A regular polygon is an n-sided polygon in which all sides are all the same length and all angles have the same degree (i.e. the polygon is both equilateral and equiangular). the formula for computing the ara of a regular polygon is:

area = n * s2
4 * tan(pie/n)
You are to write a program with three overloaded functions called computeArea that exclusively compute the areas for the following geometric objects:

- a square
- a pentagon
- a regular polygon

and identify that object as being a square, pentagon, or other regular polygon other than a square or a pentagon.

The program will ask the user to input the number of sides and the value for each side. The program will output the area and the identity of the polygon. After it computes the first user entry it will ask the user if s/he would like to compute the area of another polygon. The program will continue until the user indicates it should end.

That the program make as much sense as possible to the user note that the two questions output to the user are different.

sample output:

would you like to compute the area of a polygon?

the area of the polygon is 4. The type of polygon is a square.

would you like to compute the area of another polygon?

Explanation / Answer

#include #include #include #define PI 3.141592 using namespace std; int main() { //PROTOTYPES void computeArea(double sideLength); void computeArea(double sideLength, bool isPentagon); void computeArea(double sideLength, int sides); //LOCAL DECLARATIONS int sides; double sideLength; char again; //PROCEDURES cout > again; while (toupper(again) == 'Y') { cout > sides; cout > sideLength; cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote