Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

image text in transcribed

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

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

Database And Expert Systems Applications 24th International Conference Dexa 2013 Prague Czech Republic August 2013 Proceedings Part 1 Lncs 8055

Authors: Hendrik Decker ,Lenka Lhotska ,Sebastian Link ,Josef Basl ,A Min Tjoa

2013 Edition

3642402844, 978-3642402845

More Books

Students also viewed these Databases questions

Question

4. I can tell when team members dont mean what they say.

Answered: 1 week ago

Question

2. How were various roles filled?

Answered: 1 week ago