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

Assignment Help:

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


Related Discussions:- Create a fortran program for represent a convex polygon

Write the vhdl code for traffic light controller, The schematic of the traf...

The schematic of the traffic light controller is as shown in figure 1. There are three control buttons on the panel: HAZ (Hazard), LT (Left) and RT (Right). Whenever, HAZ is clicke

Special matrices, Special Matrices There are some "special" matrices o...

Special Matrices There are some "special" matrices out there which we may use on occasion. The square matrix is the first special matrix.  A square matrix is any matrix that s

Differentiate between high level and low level languages, The languages use...

The languages used in the module are of a type known as high-level languages. There is another set of languages known as low-level languages. (a) Differentiate between high-leve

Applications of oop, Applications of OOP, The promising areas for applicati...

Applications of OOP, The promising areas for application of OOP include: Real-time systems Simulation and modelling Object-oriented databases Hypertext, hype

The .net framework 3.5, Architecture and Components The .NET Framework 3.5 ...

Architecture and Components The .NET Framework 3.5 The .NET Structure (pronounced dot net) is an application framework that works generally on Enthusiasm Microsoft windows. It has

Selfcare project - strut frame work, Selfcare Project:   Technology U...

Selfcare Project:   Technology Used Strut Frame work, WAS 5.1, WPS 6.0, DB2, AJAX, Eclipse, Rational Application Developer 6 and  DB2 Selfcare is a big umbrella under whic

Check a file for spelling errors, Normal 0 false false fals...

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

C programming, write a function that raises an integer to a positive intege...

write a function that raises an integer to a positive integer power. call the function x_to_the_n taking two integer arguments x and n. have the function return a long int, which r

No Linux Audible, Why no Audible support for Linux? Maybe they should use a...

Why no Audible support for Linux? Maybe they should use a browser interface?

Program for create the rna sequence from the dna, Often, DNA sequences are ...

Often, DNA sequences are represented as a sequence of characters (String) and each character in the sequence corresponds with one of four nucleotides. A = adenine, C = cytosine,

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd