Assignment #7 - 88B

Assignment #7 - 88B

```                         Assignment # 7 (Pascal)
Due 30 November
T.A. Almulla M.
Weight 35

THE DETERMINANT OF 2 x 2 MATRIX

| a11   a12 |
A =  |           |
| a21   a22 |
is

DET (A) = a11 * a22 - a21 * a12

GIVEN n CONSUCUTIVE POINTS ON THE EUCLIDEAN PLANE WITH COORDINATES

(Xi, Yi), WHERE i = 1, 2, ..., n. THE ENCLOSED AREA IS ONE HALF THE

SUM OF THE DETERMINANTS OF THE ADJACENT POINTS, OR

|                                                      |
1  |     | X1 Y1 |       | X2 Y2 |             | Xn Yn |  |
AREA = --- | DET |       | + DET |       | + ... + DET |       |  |
2  |     | X2 Y2 |       | X3 Y3 |             | X1 Y1 |  |
|                                                      |

IF THE POINTS ARE TAKEN IN COUNTERCLOCKWISE DIRECTION, THE AREA WILL

HAVE A POSITIVE VALUE. IF THEY ARE TAKEN IN CLOCKWIESE DIRECTION, THE

AREA WILL HAVE NEGATIVE VALUE.

WRITE A PROGRAM THAT WILL COMPUTE THE AREA OF EACH POLYGON AND REPORT

THE FOLLOWING INFORMATION:

1 - THE TYPE OF POLYGON - TRIANGLE, QUADRILATERAL,PENTAGON, HEXAGON,

HEPTAGON, OCTAGON, NONAGON, OR DECAGON.

2 - THE COORDINATES OF THE VERTICES.

3 - THE AREA OF THE POLYGON.

I want you to run this program on three different sets of data. You

should process all of these sets in one shot, (i.e use one of the

looping techniques you leanred in pascal).

Set # 1:    4 points
(1,2)
(2,1)
(3,2)
(2,3)

Set # 2:    6 points
(0,2)
(1,1)
(3,1)
(4,2)
(3,3)
(1,3)

Set # 3:  8 points
(1,2)
(4,1)
(7,2)
(6,3)
(6,5)
(4,6)
(2,5)
(2,3)
```