Add the following method to your Rectangle class: public Rectangle intersection(Rectangle rect) Returns a new Rectangle that
Question:
Add the following method to your Rectangle class:
public Rectangle intersection(Rectangle rect)
Returns a new Rectangle that represents the largest rectangular region completely contained within both this Rectangle and the given other Rectangle. If the Rectangles do not intersect at all, returns a Rectangle with width and height both equal to 0.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Question Posted: