Question: JAVA ONLY PLEASE Double data fields named xpos, ypos (that specify the top left corner of the rectangle), width and height. (as in Examples 0.1

JAVA ONLY PLEASE Double data fields named xpos, ypos (that specify thetop left corner of the rectangle), width and height. (as in ExamplesJAVA ONLY PLEASE

Double data fields named xpos, ypos (that specify the top left corner of the rectangle), width and height. (as in Examples 0.1 and 0.2, assume that the rectangle sides are parallel to the x and y axes. See example below). (0.0,0.0) 10.0,5.0) height-2.0 width 3.0 A constructor that creates a rectangle with the specified xpos, ypos, width, and height. .Get and set methods for all the instance variables. A method contains(double px, double py) that returns true if the point px, py is inside this rectangle, false otherwise. A method touches (double px, double py) that returns true if the point px, py touches this rectangle, false otherwise. A method contains(Rectangle r) that returns true if the specified rectangle is inside this rectangle, false otherwise. A method touches(Rectangle r) that returns true if the specified rectangle touches this rectangle, false otherwise You may add other methods if necessary Study the figures below to understand when the contains method should return true, and when the touches method should return true. If the rectangles overlap, both methods should return false. Point is contained but not touching Point is touching but not contained Rectangle is contained but not touching Rectangle is touching but not contained

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!