Create a fortran program for represent a convex polygon, Programming Languages

In analytical geometry, a convex polygon can be represented by the Cartesian coordinates of its vertices, x and y. Assume such data of a polygon are stored in a file called "vertices.dat". The first line contains an integer number, n, which denotes the total number of vertices/sides of the polygon. All the following lines should contain pairs of real numbers describing the coordinates of n points (one pair per line).

Create a Fortran program called "Polygon".

a- In the main program declare all necessary variables including n, an array for the abscissas (xdata) of the points, an array for the ordinates (y-data) of the points, etc. Assume a static size of 100 for arrays.

b- Write a subroutine which opens the input file "vertices.dat", reads n and the coordinates of the points from the input file.

c- Write a subroutine which calculates the length of all sides of the polygon.

d- Write a subroutine which calculates the perimeter of the polygon.

e- Write a subroutine that writes (using format descriptor "F") the length of all sides and the perimeter to an output file called "sides.dat" with 2 decimal places accuracy.

The main program calls in turn all the subroutines inside it. Type in the following data in "vertices.dat", run your program and find the length of all sides of the polygon and its perimeter.

Submit "sides.dat" with your report.


4.1 0.0

4.0 2.0

2.0 4.0

0.0 3.0

-2.0 0.0

0.0 -3.0

1.5 -3.25

Posted Date: 2/23/2013 6:10:55 AM | Location : United States

Related Discussions:- Create a fortran program for represent a convex polygon, Assignment Help, Ask Question on Create a fortran program for represent a convex polygon, Get Answer, Expert's Help, Create a fortran program for represent a convex polygon Discussions

Write discussion on Create a fortran program for represent a convex polygon
Your posts are moderated
Related Questions
1. Introduction The Tube Challenge is a Guinness World Records challenge that tests both the physical and mental abilities of the person trying to break it. The main components

Write a program to draw the truck following figure. The program should buttons to provide When the truck runs left wheels must rotate in the correct direction. Rotating whe

Write a script called 'prob2.m' that asks the user if they wish to clear the variables in the workspace. If the user responds with the strings 'y' or 'yes' then the workspace shoul

Many applications require entering a number from a button and then the device counts that number down.  If it is a 2 digit number it can be stored in a single register.  If it is l

Consider the operation of a line of supermarket checkouts and the profiles of customers and their shopping baskets. Use a random number generator to create the data for these profi

Difference between java and j2ee programming In the basic form, the phrase java is placed as a selection terminology. On the other hand, the phrase J2EE is placed as a renderin

1.  Develop HTML code to create a Web page with the red background and title "My First Page" in any other color. 2.  Develop an HTML document with details of your name, telephon

Design an application that opens and analyses word files. Requirements: Create an application that analyses text documents. It should open a text file, read each word into an ap

Question: (i) Each time a security mechanism is installed or deleted in a Digital UNIX system, SIA is involved. Draw a Security Integration Architecture diagram. (ii) How