Question: write a c code Problem 2: Area of Polygon Resource: J.R. Hanly and E.B. Koffiman, Problem Solving and Program Design in C,8th Edition If n

write a c code  write a c code Problem 2: Area of Polygon Resource: J.R.

Problem 2: Area of Polygon Resource: J.R. Hanly and E.B. Koffiman, Problem Solving and Program Design in C,8th Edition If n points are connected to form a closed polygon as shown below, the area A of the polygon can be computed as ani i.0 Notice that although the illustrated polygon has only six distinet corners, n for this polygon is 7 because the algorithm expects that the last point, (x6, y6), will be a repeat of the initial point, (x0, Write a C program to find the area of the polygon by Represent the (x, y) coordinates of the connected points as two arrays with the size n 7 (one array keep values of x coordinate for all n points and the other keeps the values of y coordinate for all n points). Using the following two user-defined functions: 1) get corners function: Read from an input text file "polygon.txt" for array x and y. The function prototype is void get_corners(FILE *inp, double x[1, double y)) //Read data from the text file //Output: two arrays: one for x and one for y polygon_area function: Takes as parameters two arrays x, y, and its size (number of elements in the array), and returns the area of the polygon double polygon_area(double x[l, double yl, int size)t //Input: two arrays and size of the array (number of elements) //Output: area of the polygon 2) Use the for/while loop in your program to read the data from the text file and to access the arrays for the area calculation If your program does not use the loop, you will get 0 point for this

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!