Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

1. Area of Triangle using Groovy 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, 01, 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.Function Description Complete the function get TriangleArea in the editor below. The function must return an integer which indicates the area of the triangle. ALL 1 2 get TriangleArea has the following parameter(s): x: An integer array, that denotes the x coordinates. y: An integer array, that denotes the y coordinates. Constraints • 1 ≤ x[i] < 100000 • 1 ≤ y[i];< 100000 ► Input Format For Custom Testing Sample Input 0 3 0 3 6 3 0 3 0 Language: 1 Groov //Enter LL D 1 2 Sample Output 0 9Sample Input 1 3 1 0 3 Θ X ALL 1 2 2 Sample Output 1 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Lets complete the function for calculating the area of a triangle given its vertex coordinates in Gr... 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

Step: 3

blur-text-image

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

Algorithm Design And Applications

Authors: Michael T. Goodrich, Roberto Tamassia

1st Edition

1118335910, 978-1118335918

More Books

Students also viewed these Algorithms questions

Question

Define yield strength and tell how it is measured.

Answered: 1 week ago

Question

Can knowledge workers and/or professionals be performance-managed?

Answered: 1 week ago

Question

Does a PMS enhance strategic integration within HRM?

Answered: 1 week ago