Question: PLEASE HELP IN JAVA. Thank you! 1- Create a new Java class called coveringRectangle. 2- Write a static method that accepts two rectangles and returns

PLEASE HELP IN JAVA. Thank you!

1- Create a new Java class called coveringRectangle.

2- Write a static method that accepts two rectangles and returns the so-called covering rectangle. Use the declaration public static Rectangle findingCovering (Rectangle R1, Rectangle R2) The covering rectangle is formed by connecting the center of one rectangle to the center of the other rectangle with a line. This line forms the diagonal of the covering rectangle. In the below picture the lightly edged rectangle is the covering rectangle.

if the centers of the two rectangles are in line in the x-direction or the y-direction (i.e, the centers have the same x-coordinate or the same y-coordinate) then the covering rectangle wont be well defined (either the width or the height wont be well defined). In this case, use the minimum width or height of the two rectangles for the covering rectangle.

3- In the main method, you will test your routine. Create four sets of two rectangles. Each set of rectangles should test one of the four cases above. For each set, call your findCovering method. For each set, print a readable version of each rectangle and the covering rectangle. So, you should have a total of 12 printed things (3 per set, 4 sets).

PLEASE HELP IN JAVA. Thank you! 1- Create a new Java class

picture is now attached.

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!