i need a program that will compute area of various geometrical figures - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# i need a program that will compute area of various geometrical figures

Posts: 13Member
I was wishing if someone could write a program that will compute tha area of various figures. This will prompt the user to select a square,rectangle or a triangle. depending on the user selection. and also the prompt should request for the measures. the script will calculate and display the name and the area. the user will be permitted to enter values with decimal places.

square: A =side*side
rectangle A=lenght*width
triangle A=1/2base*height

• Posts: 10Member
There is a nice algorith available to calculate the area of a polygon defined by an array of x,y coordinate pairs.
It relies on the idea that the area formed by any pair of points (Xi,Yi) and (Xi+1, Yi+1) and the points projected onto the X-axis is a trapezium, with area = (Xi+1-Xi)*(Yi+Yi+1)/2.
Some trapeziums will have a negative and some a positive area. If you add all the areas traversing clockwise, the total is the area of the polygon. Going anti-clock gives the negative area.

Clive

• Posts: 13Member
: There is a nice algorith available to calculate the area of a polygon defined by an array of x,y coordinate pairs.
: It relies on the idea that the area formed by any pair of points (Xi,Yi) and (Xi+1, Yi+1) and the points projected onto the X-axis is a trapezium, with area = (Xi+1-Xi)*(Yi+Yi+1)/2.
: Some trapeziums will have a negative and some a positive area. If you add all the areas traversing clockwise, the total is the area of the polygon. Going anti-clock gives the negative area.
:
:
: Clive
:
:

So do you think you can help me out?
Thanks
• Posts: 13Member
: : There is a nice algorith available to calculate the area of a polygon defined by an array of x,y coordinate pairs.
: : It relies on the idea that the area formed by any pair of points (Xi,Yi) and (Xi+1, Yi+1) and the points projected onto the X-axis is a trapezium, with area = (Xi+1-Xi)*(Yi+Yi+1)/2.
: : Some trapeziums will have a negative and some a positive area. If you add all the areas traversing clockwise, the total is the area of the polygon. Going anti-clock gives the negative area.
: :
: :
: : Clive
: :
: :
:
: So do you think you can help me out?

: Thanks

Just some few code to help me complete the program. Please.
:

• Posts: 10Member

: : So do you think you can help me out?
: