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
#questCustomers of a particular restaurant are described with some categories. If the categories indicate the customer is a senior citizen, or the customer works for the restaurant

Show that we can represent pairs of nonnegative integers using only numbers and arithmetic operations if we represent the pair a and b as the integer that is the product 2 a 3 b .

Question 1 Discuss on UNIX kernel components 2 Explain process creation and process termination 3 When do a Deadlock occur? What are the Necessary Conditions for Deadlock

A company produces three sizes of window fans small, medium and large. the manager has formulated an LP model for fan production Maximize 6x1+8x2+5x3

Write a java program for inserting a particular node.

The method should call getAllCities() and return the index of the City that has the shortest (euclidian) distance to the. longitude and latitude passed as parameters

A number of simple student records are written to a text file. The format of some typical linesshould be - Task (1): Using a text editor, create a file with 10 such reco

After studying the concept, terminology, and implementation of CSS stylesheets, create a stylesheet to accompany your solutions to Question 1. A rich collection of styles should be

The purpose of the HB Programming test is to assess whether a candidate has sufficient knowledge to join our team here and beyond that where they would fit within our teams. The

Access Modifiers Convenience Modifiers or we can say (Access Specifies) identifies as the opportunity of accessibility of an Item and its associates. All C# kinds and kind associat