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
Write a shell script  (W.A.S.S) to calculate gross salary. Program # Write a shell script  (W.A.S.S) to calculate gross salary. echo "Enter any Basic Salary"     #echo is


Silver light uses WPF to provide included web handles Microsoft Technologies Silverlight uses WPF to provide included web handles similar to Adobe Display, but with more focus on a

Consider the following LP problem: min x 1 +3 x2 +x 3 -x 4 s.t. x 1 +x 2 +x 3 +x 4 ≥ 0 x 1 +x 2 -x 3 -x 4 ≥ 1 x 2 , x 3 ≥ 0 x 1 , x 4 ≤ 0. 1. Unique pr

Language-Integrated Query Language integrated query (LINQ, obvious "link") is a Enthusiasm .NET Structure element that contributes ancient data querying abilities to .NET dialects,

Educational Objectives: After completing this assignment, the student should be able to accomplish the following: Apply generic algorithms in solving programming problems Define an

This assignment will make use of arrays and functions to simulate a game. ASSIGNMENT DESCRIPTION This program will simulate part of the game of Yahtzee! The player will

Extensive programming platform .NET It is a new, simple, and comprehensive selection foundation. It is not a selection terminology, but it can handle several selection dialects.

A partly completed project Cwk 4-students is available for downloading from Studynet Assignments. You are required to amend this BlueJ project to implement a version of the WHEN sy

Question: (a) Outline the six norms to be considered before designing a Web page. (b) Write a program such that when a user right-clicks anywhere on a Web page, the follow