Question: Rectangle object that overlaps If you were to open the Java Application Programming Interface (API) page for the Rectangle class, you would find that there's


Rectangle object that overlaps
If you were to open the Java Application Programming Interface (API) page for the Rectangle class, you would find that there's a description of each method, including one called intersection https://doss orade.com/iavase/10/docs/api/lava/awt/Rectangle.htmlfintersection/liava.awt.Rectanglel Intersection he intersecton of the two rectangles Tthe rectangles do not intersect, te result will be an empty rectangle | Parameter t- the specifed Rectangie Returns: na largest Pactangle contained in both the specited Rectangle and in this Rectangie,erme rectangtes do nt intersect an emoty rectange In other words, the intersection method computes and returns the intersection of two Rectangle objects-the rectangle that would be formed by two overlapping Rectangles: For example, if you had two Rectangle variables called rectangle1 and rectangle2, you would call this method with the code: Rectangle the Intersection rectanglel.intersection (rectangle2) 10. For the last part of the exercise, we'll create a few different Rectangle objects which overlap. We'll then make use of the intersection method to find the resulting Rectangles and print the area of them. Inside your rectangles package, create a new class named RectangleIntersection. Be sure to have Eclipse create a main method and generate comments for you. Modify the @author comment to show both your first and last name. Add an version comment and enter today's date. 11. Inside the main method, write code to do the following: NOTE: It's a good idea to practice what's called incremental development. That is, write a few lines of code, save it, run the code, and make sure you get the expected results before moving on to the next step. Doing things this way will give you fewer lines of code to debug (because you'll only be writing a few new lines each tie), which is going to make your programming life much easier. Create two overlapping Rectangle objects using whatever values you like. HINT: You might consider using graph paper to sketch out your two Rectangles to be sure that they actually do overlap. This drawing may also help you in the remaining steps of this a. exercise
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
