# Heron’s Formula

The Heron’s formula is a famous formula used to calculate the area of a triangle based on the length of its three sides. It is called “Heron’s Formula” (sometimes called Hero’s formula) after Hero of Alexandria who was a Greek Engineer and Mathematician in 10 – 70 AD. • Take three parameters corresponding to the length of the 3 sides of a triangle: a, b and c,
• Apply Heron’s formula to calculate the area of the triangle,
• Return the area of the triangle.

You will also then need to create a small program that will:

• Ask the user to enter the length of the three sides of a triangle,
• Calculate the area of the triangle using the calculateTriangleArea() function,
• Output the area of the triangle.

#### Test Plan:

Once your code is done, complete the following tests to check it is working as expected:

 Test # Input Values (in cm) Expected Output (in cm2) Pass/Fail? #1 First side: 3Second side: 4Third side: 5 Area: 6 #2 First side: 8Second side: 10Third side: 12 Area: 39.686 #3 First side: 4Second side: 8Third side: 10 Area: 15.199

Create some extra functions to calculate the area of a square, of a rectangle and of a disc. Each function will need to accept the relevant parameters needed to calculate the area of the desired shape.

Create a menu system, where the user is asked what shapes they would like to calculate the area of before being asked to enter the relevant dimensions.

#### Did you know? Illustration of Hero’s Aeolipile (Steam Engine)

Hero published a well-recognized description of a steam-powered device called an aeolipile (sometimes called a “Hero engine”). Among his most famous inventions was a windwheel, constituting the earliest instance of wind harnessing on land.

Tagged with: