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

Need help starting a project out, I''m doing a project for class in college...

I''m doing a project for class in college and im supposed to use today''s date and figure out how old i am in months, days, minutes, and seconds. My question is what is the beset

Create c sharp classes needed to track creature viability, P4's goal is to ...

P4's goal is to design the C# classes needed to track creature viability in a MMO game under development .  Part I: Class design 1)  GameCreature class (with derived ty

What is url describe their protocol, What is URL describe theri protocol? ...

What is URL describe theri protocol? URL basicallt stands for uniform resource locator. A URL is a pointer to a particular resource on the Internet at a particular location.

Write a perl script to assign letter grades to the students, Tasks: Writ...

Tasks: Write a Perl script assignGrades.pl to assign letter grades to the students. Please use the classList2.txt file. Upon invoking, the script will access the file classL

How do you find the complexity of an algorithm, How do you get the complexi...

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.

ARM LANGUAGE, I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

Program for deleting nodes from the binary search tree, Problem: This...

Problem: This assignment is about deleting nodes from the binary search tree. You need to use given sequence to construct a binary search tree and then delete some nodes from

Program that takes names of 5 students in 2d character array, Write a progr...

Write a program that takes names of 5 students in 2D Character Array and their GPAs in 1D array. Arrange the names in alphabetical order and display on screen along with GPA.

C++, A charitable organization wants to design a special ATM machine to be ...

A charitable organization wants to design a special ATM machine to be used by needy people. The association supplies the needy person with a pin number to be able to use the ATM

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