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.

7

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
What is "No_Data_Found" in Oracle?

Objective: In a programming language of your choice, write an intelligent agent able to play block Dominoes against a player. Together with this assignment you will find two pa

One of the main strengths of the Perl programming language are its powerful text manipulation features. In this assignment, you will put them to use for writing a Perl program that

I am working on a game project using C# XNA. I only have two weeks from the deadline. Would you help me to finish it up? Please let me know as soon as possible. Thanks, Sophi

1- Allocate array with 32bit 100 element 2- Prompt the user to enter the maximum or the upper bound of the random value 3- Read the value and use it generate random numbers to init

Your solution to the problem should be housed within a while loop, which allows the grader to test your solution repeatedly without having to re-execute the script, as shown in cla

How do you get the complexity of an algorithm? What is the relation b/w the time & space complexities of an algorithm? Justify your answer with an example.

Select two different architecture styles to design and implement a software system and provide its Architecture Diagrams (implement the software with java)

Pre-order integration on Shopify store We are looking for on-call developers who can integrate Celery on client Shopify stores. Requirements a) Contented editing Shopify them

how to create a screen for messages for a data transmission system