Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that reads in the coordinates of the three vertices of a triangle and prints out the area of the triangle. The input
Write a program that reads in the coordinates of the three vertices of a triangle and prints out the area of the triangle. The input will come as pairs of numbers separated by a s| and may include decimal values. To calculate the area of the triangle, use Heron's formula: A=s(sa)(sb)(sc) Where a,b, and c are the lengths of the sides and s is the semi perimeter: (a+b+c)/2. To calculate the length of each side, you will need to use the distance formula: length=(x2x1)2+(y2y1)2 Hints: You can do square root as the 0.5 power: pow (x,0.5) or by using the sqrt function: sqrt (x). Either one requires that you include . Sample run: (user input in red) The given input represents a point at 1, 1 another at 4, 1 and a third at 1,5. Enter xy for point 1:11 Enter xy for point 2:41 Enter xy for point 3: 15 The area of the triangle is 6
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started