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.
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
Related questions
Question
Please help I need output and screen
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 1 images
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT