Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

( Geometry: the MyRectang 1 e 2 D class ) Define the MyRectang 1 2 2 D class that contains: Two doub 1 e data

(Geometry: the MyRectang1 e2D class) Define the MyRectang122D class that contains:
Two doub1e data fields named x and y that specify the center of the rectangle with getter and setter methods. (Assume the rectangle sides are parallel to x- or y-axis.)
The data fields width and height with getter and setter methods.
A no-arg constructor that creates a default rectangle with (0,0) for (x,y) and 1 for both width and height.
A constructor that creates a rectangle with the specified x,y, width, and height.
A method getArea () that returns the area of the rectangle.
A method getPerimeter () that returns the perimeter of the rectangle.
A method contains(double x, double y) that returns true if the specified point (x,y) is inside this rectangle (see Figure 10.24a).
A method contains (MyRectang1e2D r) that returns true if the specified rectangle is inside this rectangle (see Figure 10.24b).
A method overlaps (MyRectang1e2D r) that returns true if the specified rectangle overlaps with this rectangle (see Figure 10.24 c).
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

1. How will you, as city manager, handle these requests?

Answered: 1 week ago

Question

1. Identify the sources for this conflict.

Answered: 1 week ago