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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
MATLAB Please don't use AI provide screen shot for output and code Quickly
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.
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 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.
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education