Task 3 The Euclidean distance between any two points P and Q is given by: Distance PQ√√√(x1 = x2)² + (y1 Y2)² And the area of a triangle given its three vertices A, B and Ccan be calculated using Heron's formula: a 20 C Figure 3 a+b+c 8= 2 Area = √s(s - a a)(s- b)(sc) where a, b and c are the lengths of the sides of the triangle. Write a script that prompts the user to enter the coordinates of three points that form a triangle. The script should calculate the area of the triangle. It will call one function to calculate the area of the triangle using Heron's formula. This function will call subfunctions to calculate the length of each side using the Euclidean distance formula. Additionally, ensure the script verifies if the points form a valid triangle. If they do not (i.e., when the calculated area is zero), the script should display a clear and sensible error message indicating the invalidity of the triangle.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 24PE
icon
Related questions
Question
Please help I need output and screen
Task 3
The Euclidean distance between any two points P and Q is given by:
Distance PQ√√√(x1 = x2)² + (y1
Y2)²
And the area of a triangle given its three vertices A, B and Ccan be calculated using Heron's
formula:
a
20
C
Figure 3
a+b+c
8=
2
Area =
√s(s
- a a)(s- b)(sc)
where a, b and c are the lengths of the sides of the triangle.
Write a script that prompts the user to enter the coordinates of three points that form a
triangle. The script should calculate the area of the triangle. It will call one function to calculate
the area of the triangle using Heron's formula. This function will call subfunctions to calculate
the length of each side using the Euclidean distance formula.
Additionally, ensure the script verifies if the points form a valid triangle. If they do not (i.e.,
when the calculated area is zero), the script should display a clear and sensible error message
indicating the invalidity of the triangle.
Transcribed Image Text:Task 3 The Euclidean distance between any two points P and Q is given by: Distance PQ√√√(x1 = x2)² + (y1 Y2)² And the area of a triangle given its three vertices A, B and Ccan be calculated using Heron's formula: a 20 C Figure 3 a+b+c 8= 2 Area = √s(s - a a)(s- b)(sc) where a, b and c are the lengths of the sides of the triangle. Write a script that prompts the user to enter the coordinates of three points that form a triangle. The script should calculate the area of the triangle. It will call one function to calculate the area of the triangle using Heron's formula. This function will call subfunctions to calculate the length of each side using the Euclidean distance formula. Additionally, ensure the script verifies if the points form a valid triangle. If they do not (i.e., when the calculated area is zero), the script should display a clear and sensible error message indicating the invalidity of the triangle.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT