Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

8. Area of Triangle You are given 3 sets of coordinates that form a triangle. Write code to find the area of the triangle

8. Area of Triangle You are given 3 sets of coordinates that form a triangle. Write code to find the area of the triangle enc

Sample Case o Sample Input o MOMO MOMO Sample Output 0 Explanation o Here, x = [0, 3, 6] and y = [0, 3, O] would mean that th* The function is expected to return an INTEGER. * The function accepts following parameters: * 1. INTEGER_ARRAY X * 2. INTEG

8. Area of Triangle You are given 3 sets of coordinates that form a triangle. Write code to find the area of the triangle enclosed by those coordinates. For example, the 3 points have coordinates given as x = [0, 3, 6] and y = [0, 3, 0], aligned by index, so the 3 coordinates are [0,0], [3,3], [6,0]. The height of the triangle is 3, and the width is 6, so the area of the triangle is 6 * 3/2 = 9. All resulting areas will be whole numbers. Not all triangles will contain a right angle. H q Constraints 1 x[i] < 100000 1 y[i] < 100000 16 4+ 3+ H 7 -2+ H IN To getTriangleArea has the following parameter(s): x: An integer array, that denotes the x coordinates. y: An integer array, that denotes the y coordinates. + ho 10 Function Description Complete the function getTriangleArea in the editor below. The function must return an integer which indicates the area of the triangle. 8 Sample Case 0 Sample Input 0 3 oWoww 0 3 6 3 0 3 Sample Output 0 9 Explanation 0 Here, x = [0, 3, 6] and y = [0, 3, 0] would mean that the 3 coordinates are [0,0], [3,3], [6,0]. Thus, the area would be 9. 12 13 14 15 * 1. INTEGER_ARRAY X 16 * 2. INTEGER ARRAY Y */ 17 18 19 20 21 * * The function is expected to return an INTEGER. * The function accepts following parameters: int getTriangleArea (vector x, vector y) { 22 23 } return area; 24 25 int main() ...

Step by Step Solution

3.38 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

Code int getTriangleAreavector x vector y int area 0 abc are three coordinated of ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Calculus Early Transcendentals

Authors: James Stewart

7th edition

538497904, 978-0538497909

More Books

Students also viewed these Programming questions

Question

Can partitioned join be used for r r.A s? Explain your answer

Answered: 1 week ago

Question

Signals are conveyed through a variety of channels.

Answered: 1 week ago