Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started