Implement the class and write a test program that creates a

Assignment Help JAVA Programming
Reference no: EM131193373

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 (a) 
  • A method contains (Rectangle2D r) that returns true if the specified rectangle is inside this rectangle. See Figure (b) 
  • A method overlaps (Rectangle2D r) that returns true if the specified rectangle overlaps with this rectangle. See Figure (c)

920_Untitled picture.png

Implement the class and write 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)).

Please note, your implementation will be tested with other test cases too.

Reference no: EM131193373

Questions Cloud

Suppose the transmitter technology changes : Suppose the transmitter technology changes, and it becomes economicalfor an individual household. The trading city will [grow, shrink, disappear]
Do you think teams in the hospitality industry are effective : The success of the hospitality industry is especially dependent on teamwork. In order to provide exceptional customer service, team members need to have the same focus and goals. Forming a team can be a tedious process. Identify the designations and ..
Determine the angle u corresponding to equilibrium : A uniform rod AB of length 2R rests inside a hemispherical bowl of radius R as shown. Neglecting friction, determine the angle u corresponding to equilibrium.
Prepare journal entries for each transaction : Prepare journal entries for each transaction and post each transaction to the appropriate ledger accounts (use T- account format) - Prepare trial balance dated March 31,2016
Implement the class and write a test program that creates a : Implement the class and write 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)), an..
Why should organization consider utilizing systems analysis : Why should an organization consider utilizing a systems analysis and design methodology when building a new system instead of building a system in any which way that seems to be fast and simple? What value is provided by using an engineering approach..
Fiscal austerity policy : Why did many EU government use fiscal austerity policy in 2010-2015? What was the impact of this policy on business in these countries.
What are the short and long term benefits : Do you are the U.S government continue with free trades program (NAFTA)? what is the benefit for Americans? What are the short and long term benefits?
Choices in industrial and organizational psychology : Based on outside resources (journals, websites, interviews, etc.) what are three possible career choices in Industrial and Organizational Psychology?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a blog article for a codingtechnical community

write a blog article for a codingtechnical community blog.the theme is general c or java. choose any subject under this

  Application that displays a menu of three items in a resto

Modify the application in Ã?xercise 9a so that if the user makes a menu selection he or she has already made, ignore the selection - this is, do not add a second price for the same item to the total. The user is still allowed only three entries

  Design a solution to the problem by using the five steps to

the software needs to allow the restaurant owner to schedule employees for up to 40 hours in a seven-day week. the

  Develop a java based gui application

Develop a Java based GUI application(using swing) that allows the user to enter Charity/Fund information and display them in a JTable

  Describe the swing applet life cycle

Describe the swing applet life cycle. Create a swing applet that displays the date and time in a JTextField with the JLabel "Today is" when the user clicks a JButton

  Correct syntax of a common programming language

Identify and use the correct syntax of a common programming language (Java) - describe program functionality based on analysis of a given program and recall and use typical programming constructs to analyse, design and implement simple software solut..

  Write java dice program

write java dice program.

  Write java program using array list object

Write a java program (using eclipse) using ArrayList object to allow the professor to enter student's name, his or her's four test scores.

  A common useful equation

In physics, a common useful equation for finding the position s of a body in linear motion at a given time t, based on its initial position s0, initial velocity v0, and rate of acceleration a, is the following: ??= ??0+??0??+12????2. Write code to de..

  Error conditions as compared to using exception handling

What are the advantages and disadvantages of testing for error conditions as compared to using exception handling when performing input or output?

  Display an error message for all other requests

Only display the contents of files that have a ".bat" extension. Display an error message for all other requests that are not for files with the ",bat" extension

  Java threads

This is an introductory assignment on Java synchronization. You will use Java Threads while learning more about concurrency and achieving atomicity using Java’s inbuilt mechanisms.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd