Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The goal of this lab is to write an application for testing whether or not two rectangles intersect The rectangles are placed on the two-dimensional
The goal of this lab is to write an application for testing whether or not two rectangles intersect The rectangles are placed on the two-dimensional grad. For each rectangle, the program receives the coordinates of the upper-left and the lower-right corners of the triangle from the user. Then the program receives a point from the user and answers whether the point is in the rectangles, if not the distance of the point from each rectangle. Here are some execution examples of the program: % java Rechain Enter the two corners of rectangle 1: 1155 Enter the two corners of rectangle 2: 3 3 7 7 The rectangles intersect. Enter x and v: 0 5 The point is not in No.1 Its distance is 1.000000 The point is not in No.2 Its distance is 3.000000 % java Rechain Enter the two corners of rectangle 1: 1155 Enter the two corners of rectangle 2: 3 3 7 7 The rectangles intersect. Enter x and y: 4 4 The point is in No.1. The point is in No.2. % java RecMain Enter the two corners of rectangle 1: 1155 Enter the two corners of rectangle 2: 10 10 17 16 The rectangles are disjoint. Enter x and y: 2 3 The point is in No.1 The point is not in No.2 Its distance is 10.630146 The coordinates of the corners of each rectangle are decomposed into two ranges, the range of the x-coordinates and the range of the y-coordinates. For example, a rectangle whose upper-left corner is (4,10) and its lower-right corner is (11, -1) is represented by the x-range [4, 11] and the y-range I-1,10
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