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 b Figure 3 C a+b+c S 2 Area √s(sa)(s - b)(s - c) = 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.
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 b Figure 3 C a+b+c S 2 Area √s(sa)(s - b)(s - c) = 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++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter13: Structures
Section: Chapter Questions
Problem 4PP
Related questions
Question
MATLAB Please don't use AI provide screen shot for output and code Quickly
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 3 images
Recommended textbooks for you
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT