If n points are connected to form a closed polygon as shown below, the area of the polygon can be computed as n-2 Area = (½)| (Xi+1 + Xi ) (yi+1 - yi ) i=0 y (x1,Y1) (xo,Yo)= (X6,Y6) (x2,Y2) (X3,Y3)...


should write in c language! (not c++, not c#)


If n points are connected to form a closed polygon as shown below, the area of the polygon<br>can be computed as<br>n-2<br>Area = (½)| (Xi+1 + Xi ) (yi+1 - yi )<br>i=0<br>y<br>(x1,Y1)<br>(xo,Yo)=<br>(X6,Y6)<br>(x2,Y2)<br>(X3,Y3)<br>(Xs, Ys)<br>(X4,Ya)<br>n=7<br>Notice that although the illustrated polygon has only 6 distinct corners, n for this polygon is 7<br>because the algorithm expects that the last point (X6, Y6) Will be repeat of the initial point, (Xo,yo).<br>Define a structure for a point. Each point contains x coordinate and y coordinate. The<br>representation of a Polygon must be a stack of structures in your program.<br>Write a C program that takes the number of actual points (n-1) from the user. After that, user<br>enters x and y coordinates of each point. (The last point will be repeat of the initial point).<br>When you read the coordinates form the user, they are placed on your stack. In your<br>computation, you will get the coordinates from the stack.<br>Write a computeArea function which returns the area of the Polygon. Print the area of the<br>Polygon in main. Display the area with two digits after the decimal point.<br>

Extracted text: If n points are connected to form a closed polygon as shown below, the area of the polygon can be computed as n-2 Area = (½)| (Xi+1 + Xi ) (yi+1 - yi ) i=0 y (x1,Y1) (xo,Yo)= (X6,Y6) (x2,Y2) (X3,Y3) (Xs, Ys) (X4,Ya) n=7 Notice that although the illustrated polygon has only 6 distinct corners, n for this polygon is 7 because the algorithm expects that the last point (X6, Y6) Will be repeat of the initial point, (Xo,yo). Define a structure for a point. Each point contains x coordinate and y coordinate. The representation of a Polygon must be a stack of structures in your program. Write a C program that takes the number of actual points (n-1) from the user. After that, user enters x and y coordinates of each point. (The last point will be repeat of the initial point). When you read the coordinates form the user, they are placed on your stack. In your computation, you will get the coordinates from the stack. Write a computeArea function which returns the area of the Polygon. Print the area of the Polygon in main. Display the area with two digits after the decimal point.
Note: The absolute value can be computed with fabs function.<br>Example:<br>double x = - 5.0; fabs(x) is 5.0<br>double x = 0.0; fabs(x) is 0.0<br>double x = 5.0;<br>fabs(x) is 5.0<br>Sample Input:<br>Sample Output:<br>4<br>3 5<br>7 5<br>7 1<br>3 1<br>3 5<br>16.00<br>Sample Input:<br>Sample Output:<br>20.50<br>3 6<br>4 8<br>5 7<br>7 4<br>8 1<br>3 2<br>3 6<br>Sample Input:<br>Sample Output:<br>8.00<br>4 6<br>8 2<br>3 3<br>4 6<br>

Extracted text: Note: The absolute value can be computed with fabs function. Example: double x = - 5.0; fabs(x) is 5.0 double x = 0.0; fabs(x) is 0.0 double x = 5.0; fabs(x) is 5.0 Sample Input: Sample Output: 4 3 5 7 5 7 1 3 1 3 5 16.00 Sample Input: Sample Output: 20.50 3 6 4 8 5 7 7 4 8 1 3 2 3 6 Sample Input: Sample Output: 8.00 4 6 8 2 3 3 4 6

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here