Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

22.9 (Geometry: gift-wrapping algorithm for finding a convex hull) Section 22.10

ID: 3798304 • Letter: 2

Question

22.9 (Geometry: gift-wrapping algorithm for finding a convex hull) Section 22.10.1 introduced the gift-wrapping algorithm for finding a convex hull for a set of points. Assume that the Java’s coordinate system is used for the points.

Imple-ment the algorithm using the following method:

/** Return the points that form a convex hull */
public static ArrayList getConvexHull(double[][] s)

Write a test program that prompts the user to enter the set size and the points
and displays the points that form a convex hull.

Sample Run:

6

1 2.4 2.5 2 1.5 34.5 5.5 6 6 2.4 5.5 9

  

Output:

How many points are in the set? 6

Enter 6 points: 1 2.4 2.5 2 1.5 34.5 5.5 6 6 2.4 5.5 9

The convex hull is (1.5, 34.5) (5.5, 9.0) (6.0, 2.4) (2.5, 2.0) (1.0, 2.4)

CORRECT ANSWER WILL BE RATED! :)

Explanation / Answer

import java.util.ArrayList; public class Exercise09 { public static void main(String[] args) { double[][] points = new double[6][2]; for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote