Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 3: A bounding rectangle is the minimum rectangle that encloses a set of points in a two- dimensional plane, as shown in the figure

image text in transcribedimage text in transcribed

Exercise 3: A bounding rectangle is the minimum rectangle that encloses a set of points in a two- dimensional plane, as shown in the figure below Write a method that returns a bounding rectangle for a set of points in a two dimensional plane as follows: public static Rectangle getRectangle (double points) //This method finds the xpos, ypos, width and height of the / /bounding rectangle //constructs it and returns it The Rectangle class is the one that you developed in Exercise 1. Use the following test program that prompts the user to enter five points and displays the bounding rectangle's center, width, and height. As you can observe from the code, the x and y coordinates of each point are stored in the 2-d array. For example, if the points are (1.0,2.0), (1.5, 2.0), (3.5, 4.0), (2.5, 1.0), (5.0, 6.0), you would store them in the following 2-d array: 13.5 4.0] 12.5 1.0] [5.0 6.0] The code below can store up to five points, but you can change the array dimensions appropriately //Code for Exercise 3 import java.util.Scanner; public class Exercise3 public static void main(String[ ] args) doublet11] points-new double[5][2]; Scanner input - new Scanner (System.in); System.out.print ( "Enterpoints.length"points:" for (int 0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

Calculate the y parameters for the two-port in Fig. 19.79. 3 6 611

Answered: 1 week ago