Question: import java.util.*; public class RecMain { public static void main( String[] RecMain ) { Scanner keyboard = new Scanner( System.in ); System.out.print( Enter the two

 import java.util.*; public class RecMain { public static void main( String[]RecMain ) { Scanner keyboard = new Scanner( System.in ); System.out.print( "Enterthe two corners of rectangle 1: " ); Rectangle r1 = new

import java.util.*; public class RecMain { public static void main( String[] RecMain ) { Scanner keyboard = new Scanner( System.in ); System.out.print( "Enter the two corners of rectangle 1: " ); Rectangle r1 = new Rectangle( keyboard.nextDouble(), keyboard.nextDouble(), keyboard.nextDouble(), keyboard.nextDouble() ); System.out.print( "Enter the two corners of rectangle 2: " ); Rectangle r2 = new Rectangle( keyboard.nextDouble(), keyboard.nextDouble(), keyboard.nextDouble(), keyboard.nextDouble() ); boolean f = r1.disjoint( r2 ); System.out.println( ( f ) ? "The rectangles are disjoint." : "The rectangels intersects." ); System.out.print( "Enter x and y: " ); double x = keyboard.nextDouble(); double y = keyboard.nextDouble(); f = r1.isIn( x, y ); System.out.println( ( f ) ? "The point is in No.1." : "The point is not in No.1." ); if ( !f ) { System.out.printf( "Its distance is %f. ", r1.distance( x, y ) ); } f = r2.isIn( x, y ); System.out.println( ( f ) ? "The point is in No.2." : "The point is not in No.2." ); if ( !f ) { System.out.printf( "Its distance is %f. ", r2.distance( x, y ) ); } } }

***please write this in java language! thank you

% Java RecMain Enter the two corners of rectangle 1: 115 5 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 [-1,10]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!