Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

(Geometry:) Define the MyRectangle2D class that contains:

Two double data fields named x and y that specify the center of the rectangle with get and set methods. (Assume that the rectangle sides are parallel to the x- or y-axes.)

The data fields width and height with get and set 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 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 the rectangle. See Figure 8.1.

A method contains(Rectangle2D r) that returns true if the specified rectangle is inside this rectangle. See Figure 8.1.


A method overlaps(Rectangle2D r) that returns true if the specified rectangle overlaps with this rectangle. 

Implement the class and prepare a test program that creates a Rectangle2D object r1 (new Rectangle2D(2, 2, 5.5, 4.9)), displays its area and perimeter, and displays the results of r1.contains(3, 3), r1.contains(new Rectangle2D(4, 5, 10.5, 3.2)), and r1.overlaps(new Rectangle2D(3, 5, 2.3, 5.4)).

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M984784
  • Price:- $55

Guranteed 36 Hours Delivery, In Price:- $55

Have any Question?


Related Questions in Computer Engineering

Question why are the error terms in cross-sectional data

Question: Why are the error terms in cross-sectional data unlikely to be serially correlated? Can you give an example in which serial correlation could be present in a cross-sectional dataset? The response must be typed, ...

Both the search and the insertion time for a b-tree are a

Both the search and the insertion time for a B-tree are a function of the height of the tree. We would like to develop a measure of the worst-case search or insertion time. Consider a B-tree of degree d that contains a t ...

Explain why some organizations may not place enough

Explain why some organizations may not place enough importance on disaster recovery. What might happen to these organizations in the event of an actual disaster?

Question 1 with the explosion of users on social media

Question: 1. With the explosion of users on social media sites, businesses need to establish their presence on social media sites. Just search for "Vans" or "Starbucks" on Facebook for examples of company sites. To manag ...

1 potassium metal is very reactive with liquid bromine the

1. Potassium metal is very reactive with liquid bromine. The result of the reaction is the formation of a white ionic solid. Explain what happens to these elements when they form an ionic compound and write the formula f ...

String cyclic leftshift string s int k that creates and

String cyclic LeftShift (String s, int k) that creates and returns a string in which character of s has been moved left k steps, so that the characters that would "fall off' the left end are appended to the right. For ex ...

Discuss how the scope of computer security grew from

Discuss how the scope of computer security grew from physical security to include : Securing the data Limiting random and unauthorized access to that data. Involvement of personnel from multiple levels of the organizatio ...

A mixture contains 0600 moles of nah2po4 and 00800 moles of

A mixture contains 0.600 moles of NaH2PO4 and 0.0800 moles of K2HPO4. It is titrated with 0.500 molar NaOH (aq) to neutralize it completely. How many mL of the NaOH solution are required?

Two countries australia and france have their interest

Two Countries Australia and France have their interest rates to be 8% and 2 %, respectively. If their currencies trade according to 2 Australian $s buy one euro in the spot market, what will their future spot rate be in ...

Run the command netstat -athis will give you a list of all

Run the command netstat -a This will give you a list of all of the network connections your system knows about. How many do you see that are listening (meaning, there are programs that are waiting for connections from ot ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As